[gjs: 7/11] function: Improve error messages



commit 1221a4ea35bd8cc6d5371b1247b1818f54d83e3a
Author: Philip Chimento <philip chimento gmail com>
Date:   Sun Oct 27 17:44:34 2019 -0700

    function: Improve error messages
    
    While examining #72, it seems that these error messages could be made
    more accurate.

 gi/function.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gi/function.cpp b/gi/function.cpp
index de7d84db..2492556b 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -550,7 +550,11 @@ GjsCallbackTrampoline* gjs_callback_trampoline_new(
             interface_info = g_type_info_get_interface(&type_info);
             interface_type = g_base_info_get_type(interface_info);
             if (interface_type == GI_INFO_TYPE_CALLBACK) {
-                gjs_throw(context, "Callback accepts another callback as a parameter. This is not 
supported");
+                gjs_throw(context,
+                          "%s %s accepts another callback as a parameter. This "
+                          "is not supported",
+                          is_vfunc ? "VFunc" : "Callback",
+                          g_base_info_get_name(callable_info));
                 g_base_info_unref(interface_info);
                 return NULL;
             }
@@ -564,7 +568,11 @@ GjsCallbackTrampoline* gjs_callback_trampoline_new(
 
                     g_callable_info_load_arg(trampoline->info, array_length_pos, &length_arg_info);
                     if (g_arg_info_get_direction(&length_arg_info) != direction) {
-                        gjs_throw(context, "Callback has an array with different-direction length arg, not 
supported");
+                        gjs_throw(context,
+                                  "%s %s has an array with different-direction "
+                                  "length argument. This is not supported",
+                                  is_vfunc ? "VFunc" : "Callback",
+                                  g_base_info_get_name(callable_info));
                         return NULL;
                     }
 


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