2 ms·
You can add error codes and whatever else you want to propagate to an exception object.
by olavk 18y ago
You can add error codes and whatever else you want to propagate to an exception object.
- Retric 18y agoTrue in theory but the code given: catch database error { warn "Whoa, your database is broken!"; } Ignores all that and hides the error. I only point this out because I have seen a lot of real world code where people skip even the assert in the catch statement. Edit: You can add all of this stuff manually (or as part of the warn function) but I would like to see a language where you can define a standard place where all errors are logged independent of the given code unless it’s explicitly overridden. So you people can't add empty catch blocks.
- jrockway 18y agoIn Perl, you can set $SIG{__DIE__} to a function that gets all exceptions. You can also override CORE::die or CORE::GLOBAL::die.