summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimport/importer.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-12-21 21:41:22 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-12-21 21:41:22 (GMT)
commitb917755aab166ebb59ebdb5356114d373ce5cb91 (patch)
tree72d74a4a8989e0ba3cde5f83bd08ffb00bdde446 /src/helsinki.at/rhimport/importer.go
parent0912ca15a61bc9eba102fc967367f8c1665842dc (diff)
improved error handling and reporting, canceling running requests when telnet client leaves
Diffstat (limited to 'src/helsinki.at/rhimport/importer.go')
-rw-r--r--src/helsinki.at/rhimport/importer.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/helsinki.at/rhimport/importer.go b/src/helsinki.at/rhimport/importer.go
index 512daf6..1bfdf0c 100644
--- a/src/helsinki.at/rhimport/importer.go
+++ b/src/helsinki.at/rhimport/importer.go
@@ -516,6 +516,7 @@ func import_audio(ctx *ImportContext, res *ImportResult) (err error) {
if err = easy.Perform(); err != nil {
if res.ResponseCode == http.StatusNoContent {
+ rhl.Printf("import to cart/cat %d/%d got canceled", ctx.Cart, ctx.Cut)
res.Cart = ctx.Cart
res.Cut = ctx.Cut
err = nil
@@ -626,7 +627,7 @@ func cleanup_files(ctx *ImportContext) {
func ImportFile(ctx *ImportContext) (res *ImportResult, err error) {
defer cleanup_files(ctx)
- rhdl.Printf("importer: ImportFile called with: show-id: %d, pool-name: '%s', cart/cut: %d/%d", ctx.ShowId, ctx.GroupName, ctx.Cart, ctx.Cut)
+ rhl.Printf("importer: ImportFile called with: show-id: %d, pool-name: '%s', cart/cut: %d/%d", ctx.ShowId, ctx.GroupName, ctx.Cart, ctx.Cut)
if ctx.ProgressCallBack != nil {
ctx.ProgressCallBack(2, "importing", 0.0, ctx.ProgressCallBackData)
@@ -696,6 +697,7 @@ func ImportFile(ctx *ImportContext) (res *ImportResult, err error) {
return
}
if res.ResponseCode != http.StatusOK {
+ rhl.Printf("Fileimport has failed (Cart/Cut %d/%d): %s", res.Cart, res.Cut, res.ErrorString)
rmres := ImportResult{ResponseCode: http.StatusOK}
if rmCartOnErr {
if err = remove_cart(ctx, &rmres); err != nil {
@@ -706,10 +708,12 @@ func ImportFile(ctx *ImportContext) (res *ImportResult, err error) {
return
}
}
+ } else {
+ rhl.Printf("File got succesfully imported into Cart/Cut %d/%d", res.Cart, res.Cut)
}
} else {
res.ResponseCode = http.StatusBadRequest
- res.ErrorString = "The request doesn't contain enough information to be processed"
+ res.ErrorString = "importer: The request doesn't contain enough information to be processed"
}
return