[gjs/ewlsh/march-maintenance: 2/2] context: Log JavaScript errors in bootstrap code prior to exiting




commit 4acba1ea009452ac1181b4f4e894eaccddbda845
Author: Evan Welsh <contact evanwelsh com>
Date:   Sat Mar 5 11:27:30 2022 -0800

    context: Log JavaScript errors in bootstrap code prior to exiting

 gjs/context.cpp | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/gjs/context.cpp b/gjs/context.cpp
index b1cb934bc..39af31d13 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -599,6 +599,11 @@ static void load_context_module(JSContext* cx, const char* uri,
     bool ok = add_promise_reactions(
         cx, evaluation_promise, on_context_module_resolved,
         [](JSContext* cx, unsigned, JS::Value*) {
+            JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
+
+            JS::HandleValue error = args.get(0);
+            gjs_log_exception_full(cx, error, nullptr, G_LOG_LEVEL_CRITICAL);
+
             GjsContextPrivate::from_cx(cx)->main_loop_release();
 
             // Abort because this module is required.


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