[gjs: 4/11] context: Log exception when initializing



commit 0aeeba800e320bdfd138ef5bed5ff8a17a33ca34
Author: Philip Chimento <philip chimento gmail com>
Date:   Mon Oct 15 20:45:48 2018 -0700

    context: Log exception when initializing
    
    The initialization is currently all done in the constructor which is
    infallible, but we should log any pending exception before aborting if we
    are not able to create the importer.

 gjs/context.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gjs/context.cpp b/gjs/context.cpp
index df6c487e..2e5a714a 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -515,8 +515,10 @@ gjs_context_constructed(GObject *object)
 
     JS::RootedObject importer(cx, gjs_create_root_importer(cx,
         js_context->search_path ? js_context->search_path : nullptr));
-    if (!importer)
+    if (!importer) {
+        gjs_log_exception(cx);
         g_error("Failed to create root importer");
+    }
 
     JS::Value v_importer = gjs_get_global_slot(cx, GJS_GLOBAL_SLOT_IMPORTS);
     g_assert(((void) "Someone else already created root importer",


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