summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-03-11 15:47:28 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-03-11 15:47:28 (GMT)
commit869c36bf0d601e906ca1ca8b62449478c658a425 (patch)
tree533385338600df94bafec4e3fb917be75795731f
parent1e2ba79b90cba21688667f14e1cc340cdb11870d (diff)
added sourcefile to rhimport.Result
-rw-r--r--rhimport/core.go1
-rw-r--r--rhimport/session.go8
2 files changed, 5 insertions, 4 deletions
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()