From 869c36bf0d601e906ca1ca8b62449478c658a425 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 11 Mar 2016 16:47:28 +0100 Subject: added sourcefile to rhimport.Result diff --git a/rhimport/core.go b/rhimport/core.go index 9b9cd54..fd481e4 100644 --- a/rhimport/core.go +++ b/rhimport/core.go @@ -61,6 +61,7 @@ type Result struct { ErrorString string Cart uint Cut uint + SourceFile string } type Context struct { diff --git a/rhimport/session.go b/rhimport/session.go index 66705ec..f61c8fe 100644 --- a/rhimport/session.go +++ b/rhimport/session.go @@ -100,12 +100,12 @@ func sessionProgressCallback(step int, stepName string, progress float64, userda func sessionRun(ctx Context, done chan<- Result) { if err := ctx.SanityCheck(); err != nil { - done <- Result{http.StatusBadRequest, err.Error(), 0, 0} + done <- Result{ResponseCode: http.StatusBadRequest, ErrorString: err.Error()} return } if res, err := FetchFile(&ctx); err != nil { - done <- Result{http.StatusInternalServerError, err.Error(), 0, 0} + done <- Result{ResponseCode: http.StatusInternalServerError, ErrorString: err.Error()} return } else if res.ResponseCode != http.StatusOK { done <- *res @@ -113,7 +113,7 @@ func sessionRun(ctx Context, done chan<- Result) { } if res, err := ImportFile(&ctx); err != nil { - done <- Result{http.StatusInternalServerError, err.Error(), 0, 0} + done <- Result{ResponseCode: http.StatusInternalServerError, ErrorString: err.Error()} return } else { done <- *res @@ -190,7 +190,7 @@ func (self *Session) dispatchRequests() { self.cancel() } self.state = SESSION_TIMEOUT - r := &Result{500, "session timed out", 0, 0} + r := &Result{ResponseCode: http.StatusInternalServerError, ErrorString: "session timed out"} self.callDoneHandler(r) if self.removeFunc != nil { self.removeFunc() -- cgit v0.10.2