# HG changeset patch # User Matti Hamalainen # Date 1531112749 -10800 # Node ID 2dfe46fda09e866442b32908a72a475be0109930 # Parent 170e447e09841735b172d8b3d298e1c3638a7911 Improve error handling through ioctx. diff -r 170e447e0984 -r 2dfe46fda09e sidlib.c --- a/sidlib.c Mon Jul 09 07:30:37 2018 +0300 +++ b/sidlib.c Mon Jul 09 08:05:49 2018 +0300 @@ -133,8 +133,8 @@ !thfread_be32(ctx, &psid->speed)) { th_io_error(ctx, ctx->status, - "Could not read PSID/RSID header: %s.\n", - th_error_str(ctx->status)); + "Could not read PSID/RSID header from '%s': %s.\n", + ctx->filename, th_error_str(ctx->status)); goto error; } @@ -145,7 +145,8 @@ psid->version < 1 || psid->version > 4) { th_io_error(ctx, THERR_NOT_SUPPORTED, - "Not a supported PSID or RSID file.\n"); + "Not a supported PSID or RSID file: %s\n", + ctx->filename); goto error; } @@ -156,8 +157,8 @@ !si_fread_str(ctx, &psid->sidCopyright, PSID_STR_LEN)) { th_io_error(ctx, ctx->status, - "Error reading SID file header: %s.\n", - th_error_str(ctx->status)); + "Error reading SID file header from '%s': %s.\n", + ctx->filename, th_error_str(ctx->status)); goto error; } @@ -172,8 +173,8 @@ !thfread_u8(ctx, &psid->sid3Addr)) { th_io_error(ctx, ctx->status, - "Error reading PSID/RSID v2+ extra header data: %s.\n", - th_error_str(ctx->status)); + "Error reading PSID/RSID v2+ extra header data from '%s': %s.\n", + ctx->filename, th_error_str(ctx->status)); goto error; } }