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 | bcc3483ff7e719c4e429b22e045937fd19e34400 (patch) | |
tree | 29ad9aa3523e9d6c07f99f0e85c847ba61d26367 /importer.go | |
parent | 4a358bab91c53ac951567c0f25d08368095b843a (diff) |
basic session handling works now
Diffstat (limited to 'importer.go')
-rw-r--r-- | importer.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/importer.go b/importer.go index 1bfdf0c..a245270 100644 --- a/importer.go +++ b/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 } } |