summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rhimportd/ctrlTelnet.go5
-rw-r--r--src/rhimportd/ctrlWatchDir.go6
-rw-r--r--src/rhimportd/ctrlWebSimple.go6
3 files changed, 14 insertions, 3 deletions
diff --git a/src/rhimportd/ctrlTelnet.go b/src/rhimportd/ctrlTelnet.go
index ae4b8f7..83bb989 100644
--- a/src/rhimportd/ctrlTelnet.go
+++ b/src/rhimportd/ctrlTelnet.go
@@ -300,9 +300,12 @@ func telnetRun(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.D
c.Sayln("")
c.Sayln("normalizing file '%s'", ctx.SourceFile)
- if err := rhimport.NormalizeFile(ctx); err != nil {
+ if res, err := rhimport.NormalizeFile(ctx); err != nil {
c.Sayln("normalize file error: %s", err)
return false
+ } else if res.ResponseCode != http.StatusOK {
+ c.Sayln("normalize file error: %s", res.ErrorString)
+ return false
}
c.Sayln("")
diff --git a/src/rhimportd/ctrlWatchDir.go b/src/rhimportd/ctrlWatchDir.go
index 7b185c0..2335c8f 100644
--- a/src/rhimportd/ctrlWatchDir.go
+++ b/src/rhimportd/ctrlWatchDir.go
@@ -149,10 +149,14 @@ func watchDirHandler(conf *rhimport.Config, db *rddb.DBChan, ctx *rhimport.Conte
return
}
- if err = rhimport.NormalizeFile(ctx); err != nil {
+ if res, err = rhimport.NormalizeFile(ctx); err != nil {
watchDirErrorResponse(filename, http.StatusInternalServerError, err.Error(), "")
return
}
+ if res.ResponseCode != http.StatusOK {
+ watchDirErrorResponse(filename, res.ResponseCode, res.ErrorString, "")
+ return
+ }
if res, err = rhimport.ImportFile(ctx); err != nil {
watchDirErrorResponse(filename, http.StatusInternalServerError, err.Error(), res.SourceFile)
diff --git a/src/rhimportd/ctrlWebSimple.go b/src/rhimportd/ctrlWebSimple.go
index e690571..a44bc0f 100644
--- a/src/rhimportd/ctrlWebSimple.go
+++ b/src/rhimportd/ctrlWebSimple.go
@@ -147,10 +147,14 @@ func webSimpleHandler(conf *rhimport.Config, db *rddb.DBChan, sessions *rhimport
return
}
- if err = rhimport.NormalizeFile(ctx); err != nil {
+ if res, err = rhimport.NormalizeFile(ctx); err != nil {
webSimpleErrorResponse(w, http.StatusInternalServerError, err.Error())
return
}
+ if res.ResponseCode != http.StatusOK {
+ webSimpleErrorResponse(w, res.ResponseCode, res.ErrorString)
+ return
+ }
if res, err = rhimport.ImportFile(ctx); err != nil {
webSimpleErrorResponse(w, http.StatusInternalServerError, err.Error())