News for hackers. Stuff that matters.
Re:Error codes vs exceptions: critical code vs typical code by mathgladiator on Tuesday September 25, 2012 @04:13AM (#4569217)
When I "simplify" a bunch of stuff into a nice pretty "thing", I'll catch all exceptions (Throwable) and then re-throw if. Depending on the thing, I'll stick an enum in my exception. Usually, I only care about "should I retry?" or "give up"

Personally, I think exceptions were a mistake for errors. I prefer how you do error codes via ocaml.

let val = func ... in match val with Result(v) -> do nice thing | Error(500) -> retry | Error(503) -> retry | Error(_) -> abort

There are no comments on this comment yet.