Hacker News new | ask | show | jobs
by mekster 1753 days ago
Not sure why people don't like exceptions. Throw different error classes according to the source of the problem and just handle differently in the upper classes.

throw new ErrorUser('Bad input')

-> Show friendly error messages.

throw new ErrorFatal('Db unavailable')

-> Email error to dev and quit.

I never like the verbosity of returning errors from each methods.

How hard is it to trace the stack when you're supposed to be using error logging tools like Sentry?