#include "tads.h" #include "t3.h" _main(args) { t3SetSay(&_say_embed); a(); } _say_embed(str) { tadsSay(str); } class Exception: object construct(msg) { exceptionMessage = msg; } exceptionMessage = '' ; class ResourceError: Exception; class ParsingError: Exception; a() { b(1); b(2); b(3); } b(x) { "This is b(<>)\n"; try { c(x); } catch (Exception exc) { "b: Caught an exception: <>\n"; } "Done with b(<>)\n"; } c(x) { "This is c(<>)\n"; try { d(x); } catch(ParsingError perr) { "c: Caught a parsing error: <>\n"; } finally { "In c's finally clause\n"; } "Done with c(<>)\n"; } d(x) { "This is d(<>)\n"; e(x); "Done with d(<>)\n"; } e(x) { "This is e(<>)\n"; if (x == 1) { "Throwing resource error...\n"; throw new ResourceError('some resource error'); } else if (x == 2) { "Throwing parsing error...\n"; throw new ParsingError('some parsing error'); } "Done with e(<>)\n"; }