Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
barrkel
· 10y ago · 0 comments
Returning an error type, and, in the caller, propagating that return type further up, is isomorphic to exceptions, except it's a lot more busywork, a lot more code bloat, and a lot easier to get wrong.
Comments
[–]
yoklov
10y ago
It's also encoded in the return type of the function, so you get static type checking -- a property not present for exceptions.
[–]
barrkel
OP
10y ago
You say that like it's desirable. I think Java's experience of checked exceptions shows that it's of very dubious benefit.
[–]
perspectivep
10y ago
And you have to remember to log the error at every level of the stack, otherwise you're left with an error code that has no context.