[gjs: 3/6] _gjs_context_run_jobs: Log uncatchable exceptions, except System.exit()



commit d7c1dbdeacd0e279a9b19d3c42e9829ced206818
Author: Simon McVittie <smcv debian org>
Date:   Tue Jan 30 08:29:33 2018 +0000

    _gjs_context_run_jobs: Log uncatchable exceptions, except System.exit()
    
    If the call into JavaScript returns false without setting the
    exception, then either we're trying to exit, or something has gone
    badly wrong.
    
    Signed-off-by: Simon McVittie <smcv debian org>

 gjs/context.cpp | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 6998ee0e..62c1845d 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -634,6 +634,10 @@ _gjs_context_run_jobs(GjsContext *gjs_context)
                  * System.exit() works in the interactive shell and when
                  * exiting the interpreter. */
                 if (!JS_IsExceptionPending(cx)) {
+                    /* System.exit() is an uncatchable exception, but does not
+                     * indicate a bug. Log everything else. */
+                    if (!_gjs_context_should_exit(gjs_context, nullptr))
+                        g_critical("Promise callback terminated with uncatchable exception");
                     retval = false;
                     continue;
                 }


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