changeset 185:2dfe46fda09e

Improve error handling through ioctx.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 09 Jul 2018 08:05:49 +0300
parents 170e447e0984
children 2f129ea15405
files sidlib.c
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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;
         }
     }