diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-12-21 23:45:49 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-12-21 23:45:49 (GMT) |
commit | c0463be82447f269d9947d16a40881dbbe600827 (patch) | |
tree | 323dbe19236ee179bea46c9d40af54e2a3403eb3 /src/helsinki.at/rhimport/importer.go | |
parent | b917755aab166ebb59ebdb5356114d373ce5cb91 (diff) |
basic session handling works now
Diffstat (limited to 'src/helsinki.at/rhimport/importer.go')
-rw-r--r-- | src/helsinki.at/rhimport/importer.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/helsinki.at/rhimport/importer.go b/src/helsinki.at/rhimport/importer.go index 1bfdf0c..a245270 100644 --- a/src/helsinki.at/rhimport/importer.go +++ b/src/helsinki.at/rhimport/importer.go @@ -693,18 +693,20 @@ func ImportFile(ctx *ImportContext) (res *ImportResult, err error) { } if ctx.Cart != 0 && ctx.Cut != 0 { - if err = import_audio(ctx, res); err != nil { - return - } - if res.ResponseCode != http.StatusOK { - rhl.Printf("Fileimport has failed (Cart/Cut %d/%d): %s", res.Cart, res.Cut, res.ErrorString) + if err = import_audio(ctx, res); err != nil || res.ResponseCode != http.StatusOK { + if err != nil { + rhl.Printf("Fileimport has failed (Cart/Cut %d/%d): %s", ctx.Cart, ctx.Cut, err) + } else { + rhl.Printf("Fileimport has failed (Cart/Cut %d/%d): %s", res.Cart, res.Cut, res.ErrorString) + } + // Try to clean up after failed import rmres := ImportResult{ResponseCode: http.StatusOK} if rmCartOnErr { - if err = remove_cart(ctx, &rmres); err != nil { + if rerr := remove_cart(ctx, &rmres); rerr != nil { return } } else if rmCutOnErr { - if err = remove_cut(ctx, &rmres); err != nil { + if rerr := remove_cut(ctx, &rmres); rerr != nil { return } } |