Created
December 1, 2010 18:57
-
-
Save tene/724008 to your computer and use it in GitHub Desktop.
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
[sweeks@sweeks-laptop parrot]$ ./parrot /tmp/subthrow.pir | |
throwing parrot;Exception | |
in EH, caught a: Exception | |
message is: :( | |
Resuming... | |
back from EH | |
throwing LolException | |
in EH, caught a: LolException | |
message is: OHAI | |
Resuming... | |
back from EH |
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
[sweeks@sweeks-laptop ~]$ parrot /tmp/subthrow.pir | |
throwing parrot;Exception | |
in EH, caught a: Exception | |
message is: :( | |
Resuming... | |
back from EH | |
throwing LolException | |
in EH, caught a: Exception | |
message is: Not a throwable object | |
Resuming... | |
back from EH |
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
.sub main :main | |
.local pmc exc, lexc, lex | |
exc = get_class 'Exception' | |
lexc = subclass exc, 'LolException' | |
lex = new lexc | |
lex['message'] = 'OHAI' | |
push_eh gotit | |
say 'throwing parrot;Exception' | |
die ':(' | |
say 'back from EH' | |
say 'throwing LolException' | |
throw lex | |
say 'back from EH' | |
pop_eh | |
exit 0 | |
gotit: | |
.local pmc ex, cont | |
.local string msg, type | |
.get_results(ex) | |
type = typeof ex | |
print 'in EH, caught a: ' | |
say type | |
msg = ex | |
print 'message is: ' | |
say msg | |
say 'Resuming...' | |
cont = ex['resume'] | |
cont() | |
.end | |
.namespace ['LolException'] | |
.sub 'lol' :method | |
say 'ohai' | |
.end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment