[gnome-builder/wip/gjs-indexer-robustness: 1/2] gjs_symbols: Catch all gjs exceptions to avoid criticals
- From: Patrick Griffis <pgriffis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gjs-indexer-robustness: 1/2] gjs_symbols: Catch all gjs exceptions to avoid criticals
- Date: Sat, 4 Apr 2020 16:37:12 +0000 (UTC)
commit caf369f66c7518660c1299c8bbe6e57102114664
Author: Patrick Griffis <tingping tingping se>
Date: Sat Apr 4 09:34:06 2020 -0700
gjs_symbols: Catch all gjs exceptions to avoid criticals
src/plugins/gjs-symbols/gjs_symbols.py | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/src/plugins/gjs-symbols/gjs_symbols.py b/src/plugins/gjs-symbols/gjs_symbols.py
index 26e19c7a8..b96de08cc 100644
--- a/src/plugins/gjs-symbols/gjs_symbols.py
+++ b/src/plugins/gjs-symbols/gjs_symbols.py
@@ -242,14 +242,19 @@ class JsSymbolTree(GObject.Object, Ide.SymbolTree):
JS_SCRIPT = \
"""var data;
-if (ARGV[0] === '--file') {
- const GLib = imports.gi.GLib;
- var ret = GLib.file_get_contents(ARGV[1]);
- data = ret[1];
-} else {
- data = ARGV[0];
+try {
+ if (ARGV[0] === '--file') {
+ const GLib = imports.gi.GLib;
+ var ret = GLib.file_get_contents(ARGV[1]);
+ data = ret[1];
+ } else {
+ data = ARGV[0];
+ }
+ print(JSON.stringify(Reflect.parse(data, {source: '%s'})));
+} catch (e) {
+ imports.system.exit(1);
}
-print(JSON.stringify(Reflect.parse(data, {source: '%s'})));""".replace('\n', ' ')
+""".replace('\n', ' ')
class GjsSymbolProvider(Ide.Object, Ide.SymbolResolver):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]