changeset 106:9ff4f6da3db8

Improve error handling.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 15 Feb 2016 09:07:25 +0200
parents 09ca9d9a8710
children 99e6984a25ae
files sidinfo.c
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/sidinfo.c	Mon Feb 15 06:07:50 2016 +0200
+++ b/sidinfo.c	Mon Feb 15 09:07:25 2016 +0200
@@ -639,14 +639,17 @@
         th_ioctx *ctx;
         if ((ctx = th_io_fopen(&th_stdio_io_ops, setSLDBPath, "r")) == NULL)
         {
-            THERR("Could not open SLDB '%s'.\n", setSLDBPath);
+            THERR("Could not open SLDB '%s'.\n",
+                setSLDBPath);
             goto out;
         }
 
+        THMSG(0, "Reading SLDB.\n");
         if ((sidSLDB = si_sldb_new()) == NULL ||
-            si_sldb_read(ctx, sidSLDB) != THERR_OK)
+            (ret = si_sldb_read(ctx, sidSLDB)) != THERR_OK)
         {
-            THERR("Error parsing SLDB.\n");
+            THERR("Error parsing SLDB: %d, %s\n",
+                ret, th_error_str(ret));
             th_io_close(ctx);
             goto out;
         }
@@ -654,8 +657,8 @@
 
         if ((ret = si_sldb_build_index(sidSLDB)) != THERR_OK)
         {
-            THERR("Error building SLDB index: %s.\n",
-                th_error_str(ret));
+            THERR("Error building SLDB index: %d, %s.\n",
+                ret, th_error_str(ret));
             goto out;
         }
     }