Created
September 10, 2013 22:51
-
-
Save ptomato/6516878 to your computer and use it in GitHub Desktop.
Exceptions are treated differently depending on where they occur in GJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Gtk = imports.gi.Gtk; | |
Gtk.init(null); | |
let w = new Gtk.Window(); | |
let b = new Gtk.Button({ label: "Click me for an exception" }); | |
w.add(b); | |
b.connect('clicked', function() { | |
throw("This exception is not caught, only printed"); | |
}); | |
w.connect('destroy', Gtk.main_quit); | |
w.show_all(); | |
try { | |
Gtk.main(); | |
throw("This exception is caught"); | |
} catch(e) { | |
print("The exception I caught was this:", e); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment