summaryrefslogtreecommitdiff
path: root/example.pl
diff options
context:
space:
mode:
Diffstat (limited to 'example.pl')
-rw-r--r--example.pl13
1 files changed, 13 insertions, 0 deletions
diff --git a/example.pl b/example.pl
index c2c8335..6633ff0 100644
--- a/example.pl
+++ b/example.pl
@@ -22,3 +22,16 @@ curly(A) :- A = {one,two,three}.
tester(A, B) :- !, A = B.
tester(A, B) :- true.
+
+thrower(_, 10).
+thrower(_, 20).
+thrower(inner, _) :- throw(number(30)).
+thrower(outer, _) :- throw(hehe).
+thrower(_, 100).
+
+throwtest(Type, L) :-
+ catch(
+ catch((thrower(Type, N), L=N), number(N), L=N),
+ Other,
+ L=outer_exception(Other)
+ ).