Hacker News new | past | comments | ask | show | jobs | submit login

You can add error codes and whatever else you want to propagate to an exception object.



True 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.


In Perl, you can set $SIG{__DIE__} to a function that gets all exceptions. You can also override CORE::die or CORE::GLOBAL::die.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: