summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimportd
diff options
context:
space:
mode:
Diffstat (limited to 'src/helsinki.at/rhimportd')
-rw-r--r--src/helsinki.at/rhimportd/ctrlWebSimple.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/helsinki.at/rhimportd/ctrlWebSimple.go b/src/helsinki.at/rhimportd/ctrlWebSimple.go
index 4cac593..9b25dad 100644
--- a/src/helsinki.at/rhimportd/ctrlWebSimple.go
+++ b/src/helsinki.at/rhimportd/ctrlWebSimple.go
@@ -59,11 +59,11 @@ func webSimpleErrorResponse(w http.ResponseWriter, code int, error_str string) {
encoder.Encode(respdata)
}
-func webSimpleResponse(w http.ResponseWriter) {
+func webSimpleResponse(w http.ResponseWriter, result *rhimport.ImportResult) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusInternalServerError)
encoder := json.NewEncoder(w)
- respdata := webSimpleResponseData{200, "SUCCESS"}
+ respdata := webSimpleResponseData{result.ResponseCode, result.ErrorString}
encoder.Encode(respdata)
}
@@ -108,16 +108,17 @@ func webSimpleHandler(conf *rhimport.Config, rddb *rhimport.RdDb, trusted bool,
return
}
- if err := rhimport.FetchFile(ctx); err != nil {
+ if err = rhimport.FetchFile(ctx); err != nil {
webSimpleErrorResponse(w, http.StatusInternalServerError, err.Error())
return
}
- if err := rhimport.ImportFile(ctx); err != nil {
+ var result *rhimport.ImportResult
+ if result, err = rhimport.ImportFile(ctx); err != nil {
webSimpleErrorResponse(w, http.StatusInternalServerError, err.Error())
return
}
- webSimpleResponse(w)
+ webSimpleResponse(w, result)
return
}