[gjs: 5/15] context: Clarification in GjsContextPrivate::handle_exit_code()




commit ee46d3c18f8a1aa86573d94189184ec2a65c55b1
Author: Philip Chimento <philip chimento gmail com>
Date:   Sat Nov 27 17:59:16 2021 -0800

    context: Clarification in GjsContextPrivate::handle_exit_code()
    
    Clarify that the return value must be used, and give the "type" parameter
    a better name (it's a string representing the type of source code passed
    in to the function.)

 gjs/context-private.h | 7 ++++---
 gjs/context.cpp       | 8 ++++----
 2 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/gjs/context-private.h b/gjs/context-private.h
index 84da27a8e..d0660893e 100644
--- a/gjs/context-private.h
+++ b/gjs/context-private.h
@@ -139,9 +139,10 @@ class GjsContextPrivate : public JS::JobQueue {
     void start_draining_job_queue(void);
     void stop_draining_job_queue(void);
 
-    bool handle_exit_code(bool no_sync_error_pending, const char* type,
-                          const char* identifier, uint8_t* exit_code,
-                          GError** error);
+    [[nodiscard]] bool handle_exit_code(bool no_sync_error_pending,
+                                        const char* source_type,
+                                        const char* identifier,
+                                        uint8_t* exit_code, GError** error);
     [[nodiscard]] bool auto_profile_enter(void);
     void auto_profile_exit(bool status);
 
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 7246d1e65..d964670ee 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -1219,7 +1219,7 @@ void GjsContextPrivate::auto_profile_exit(bool auto_profile) {
 }
 
 bool GjsContextPrivate::handle_exit_code(bool no_sync_error_pending,
-                                         const char* type,
+                                         const char* source_type,
                                          const char* identifier,
                                          uint8_t* exit_code, GError** error) {
     uint8_t code;
@@ -1238,7 +1238,7 @@ bool GjsContextPrivate::handle_exit_code(bool no_sync_error_pending,
     // true synchronously
     if (JS_IsExceptionPending(m_cx)) {
         g_set_error(error, GJS_ERROR, GJS_ERROR_FAILED,
-                    "%s %s threw an exception", type, identifier);
+                    "%s %s threw an exception", source_type, identifier);
         gjs_log_exception_uncaught(m_cx);
 
         *exit_code = 1;
@@ -1252,10 +1252,10 @@ bool GjsContextPrivate::handle_exit_code(bool no_sync_error_pending,
         return true;
     }
 
-    g_critical("%s %s terminated with an uncatchable exception", type,
+    g_critical("%s %s terminated with an uncatchable exception", source_type,
                identifier);
     g_set_error(error, GJS_ERROR, GJS_ERROR_FAILED,
-                "%s %s terminated with an uncatchable exception", type,
+                "%s %s terminated with an uncatchable exception", source_type,
                 identifier);
 
     gjs_log_exception_uncaught(m_cx);


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