diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-12-12 01:41:25 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-12-12 01:41:25 (GMT) |
commit | d5450bb18ea879ca9a63aa1d16a5c647e8ecf692 (patch) | |
tree | a6e934caee5f96b686a9a4b8d677a9eacbae067c /src/helsinki.at/rhimportd | |
parent | 6ceb3358b6ffbe803e4fe1d811b5a2f266fc49d9 (diff) |
ImportFile now passes through result from RDXport
Diffstat (limited to 'src/helsinki.at/rhimportd')
-rw-r--r-- | src/helsinki.at/rhimportd/ctrlWebSimple.go | 11 |
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 } |