2 ms·
I think checked exceptions get a bad rap, but Cliff makes a good point: defaults matter and rethrowing should be the default. go's error codes are better than
by kjeetgill 8y ago
I think checked exceptions get a bad rap, but Cliff makes a good point: defaults matter and rethrowing should be the default.
go's error codes are better than in C but just act like "all exceptions are checked" from a Java angle.
I think checked exception make sense at module boundries. If I'm calling into Zlib or Guava, their function's type signatures should call out error modes and thus be checked.
That's my "solution": keep checked exceptions based on the function signature but NOT based on the exception type. It's roughly what best practices are now. Wrap it in runtime.
I think Optional/Either/Try/Manad versions boil down to about this same scheme.