summaryrefslogtreecommitdiff
path: root/examples/example_91_unhandled_exception.nim
diff options
context:
space:
mode:
Diffstat (limited to 'examples/example_91_unhandled_exception.nim')
-rwxr-xr-xexamples/example_91_unhandled_exception.nim18
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/example_91_unhandled_exception.nim b/examples/example_91_unhandled_exception.nim
new file mode 100755
index 0000000..d9f46c0
--- /dev/null
+++ b/examples/example_91_unhandled_exception.nim
@@ -0,0 +1,18 @@
+# This example shows what happens when an unhandled exception occurs in the main loop.
+
+import nigui
+
+app.init()
+
+var window = newWindow()
+
+var container = newLayoutContainer()
+window.add(container)
+
+var button = newButton("Raise Exception")
+container.add(button)
+button.onClick = proc(event: ClickEvent) =
+ raise newException(Exception, "Test Exception")
+
+window.show()
+app.run()