[gjs/esm/static-imports] Fix error reporting for modules.
- From: Evan Welsh <ewlsh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/esm/static-imports] Fix error reporting for modules.
- Date: Fri, 29 Jan 2021 02:22:50 +0000 (UTC)
commit ebc7a7ad0f3c46ea7450d22b8035ec5c87ec574f
Author: Evan Welsh <contact evanwelsh com>
Date: Thu Jan 28 18:22:44 2021 -0800
Fix error reporting for modules.
gjs/console.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gjs/console.cpp b/gjs/console.cpp
index 12e6139e..0acd7ad4 100644
--- a/gjs/console.cpp
+++ b/gjs/console.cpp
@@ -176,17 +176,19 @@ int define_argv_and_eval_script(GjsContext* js_context, int argc,
}
/* evaluate the script */
- int code;
+ int code = 0;
if (exec_as_module) {
GjsAutoUnref<GFile> output = g_file_new_for_commandline_arg(filename);
GjsAutoChar uri = g_file_get_uri(output);
if (!gjs_context_register_module(js_context, uri, uri, &error)) {
g_critical("%s", error->message);
+ g_clear_error(&error);
code = 1;
}
uint8_t code_u8 = 0;
- if (!gjs_context_eval_module(js_context, uri, &code_u8, &error)) {
+ if (!code &&
+ !gjs_context_eval_module(js_context, uri, &code_u8, &error)) {
code = code_u8;
if (!g_error_matches(error, GJS_ERROR, GJS_ERROR_SYSTEM_EXIT))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]