summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimportd/ctrlWebSimple.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-12-19 22:07:08 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-12-19 22:07:15 (GMT)
commit94eab548c583491912335d58f6442eb952cec5ab (patch)
tree1cfcd618f196343fab14ff2b75e48da60292f3b2 /src/helsinki.at/rhimportd/ctrlWebSimple.go
parent5559994f6c1cde34cb806fbc6bcc30e0ac4751f0 (diff)
fetcher now checks for permissions
improved error handling for fetcher
Diffstat (limited to 'src/helsinki.at/rhimportd/ctrlWebSimple.go')
-rw-r--r--src/helsinki.at/rhimportd/ctrlWebSimple.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/helsinki.at/rhimportd/ctrlWebSimple.go b/src/helsinki.at/rhimportd/ctrlWebSimple.go
index 2de324f..c5b81ce 100644
--- a/src/helsinki.at/rhimportd/ctrlWebSimple.go
+++ b/src/helsinki.at/rhimportd/ctrlWebSimple.go
@@ -141,22 +141,26 @@ func webSimpleHandler(conf *rhimport.Config, rddb *rhimport.RdDb, trusted bool,
return
}
- if err = rhimport.FetchFile(ctx); err != nil {
+ var fres *rhimport.FetchResult
+ if fres, err = rhimport.FetchFile(ctx); err != nil {
webSimpleErrorResponse(w, http.StatusInternalServerError, err.Error())
return
}
+ if fres.ResponseCode != http.StatusOK {
+ webSimpleErrorResponse(w, fres.ResponseCode, fres.ErrorString)
+ }
- var result *rhimport.ImportResult
- if result, err = rhimport.ImportFile(ctx); err != nil {
+ var ires *rhimport.ImportResult
+ if ires, err = rhimport.ImportFile(ctx); err != nil {
webSimpleErrorResponse(w, http.StatusInternalServerError, err.Error())
return
}
- if result.ResponseCode == http.StatusOK {
+ if ires.ResponseCode == http.StatusOK {
rhl.Println("ImportFile succesfully imported", ctx.SourceFile)
} else {
rhl.Println("ImportFile import of", ctx.SourceFile, "was unsuccesful")
}
- webSimpleResponse(w, result)
+ webSimpleResponse(w, ires)
return
}