[gnome-builder/wip/chergert/bug1: 13/18] gdb: be more explicit with failure case



commit 88e7abb2e05063d1ea68d32f3594be338a495ad1
Author: Christian Hergert <chergert redhat com>
Date:   Sat Aug 26 23:21:30 2017 -0700

    gdb: be more explicit with failure case
    
    This can be helpful to know when debugging, as to if no stream was set
    vs the stream being closed.

 plugins/gdb/gbp-gdb-debugger.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/plugins/gdb/gbp-gdb-debugger.c b/plugins/gdb/gbp-gdb-debugger.c
index 25ad609..bffd68e 100644
--- a/plugins/gdb/gbp-gdb-debugger.c
+++ b/plugins/gdb/gbp-gdb-debugger.c
@@ -2475,12 +2475,21 @@ gbp_gdb_debugger_check_ready (GbpGdbDebugger  *self,
 {
   g_assert (GBP_IS_GDB_DEBUGGER (self));
 
-  if (self->io_stream == NULL || g_io_stream_is_closed (self->io_stream))
+  if (self->io_stream == NULL)
+    {
+      g_set_error (error,
+                   G_IO_ERROR,
+                   G_IO_ERROR_INVAL,
+                   "The connection to gdb has not been set");
+      return FALSE;
+    }
+
+  if (g_io_stream_is_closed (self->io_stream))
     {
       g_set_error (error,
                    G_IO_ERROR,
                    G_IO_ERROR_CLOSED,
-                   "The connection to gdb is closed or has not been set");
+                   "The connection is closed");
       return FALSE;
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]