diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-03-11 16:39:12 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-03-11 16:39:12 (GMT) |
commit | e22e19a7ab173a43376ff19da9eaf6d50032c915 (patch) | |
tree | 0f3cb7f4d0c40cad6d039ed2dc4960649122758b /rhimport/session.go | |
parent | 78d356b26f82e7d1c26111d07024778ae2055e1c (diff) |
introduced SourceFilePolicy
Diffstat (limited to 'rhimport/session.go')
-rw-r--r-- | rhimport/session.go | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/rhimport/session.go b/rhimport/session.go index f61c8fe..13d31cc 100644 --- a/rhimport/session.go +++ b/rhimport/session.go @@ -99,26 +99,29 @@ func sessionProgressCallback(step int, stepName string, progress float64, userda } func sessionRun(ctx Context, done chan<- Result) { - if err := ctx.SanityCheck(); err != nil { + err := ctx.SanityCheck() + if err != nil { done <- Result{ResponseCode: http.StatusBadRequest, ErrorString: err.Error()} return } - if res, err := FetchFile(&ctx); err != nil { + var res *Result + res, err = FetchFile(&ctx) + if err != nil { done <- Result{ResponseCode: http.StatusInternalServerError, ErrorString: err.Error()} return - } else if res.ResponseCode != http.StatusOK { + } + if res.ResponseCode != http.StatusOK { done <- *res return } - if res, err := ImportFile(&ctx); err != nil { - done <- Result{ResponseCode: http.StatusInternalServerError, ErrorString: err.Error()} - return - } else { - done <- *res - return + res, err = ImportFile(&ctx) + if err != nil { + res.ResponseCode = http.StatusInternalServerError + res.ErrorString = err.Error() } + done <- *res } func (self *Session) run(timeout time.Duration) { |