8 ms·
> I'd be curious what other people think about this. I think that checked exceptions are a failed experiment in language design. They basically force you to le
by brazzy 13y ago
> I'd be curious what other people think about this.
I think that checked exceptions are a failed experiment in language design. They basically force you to leak abstractions all over your code, reintroducing a lot of the pain of error codes.
- sergiosgc 13y agoYou don't need to leak abstractions on exceptions. Libraries should wrap the exceptions and provide meaningful exceptions, not dependent on the exact implementation. Example: public String setCache(String key, String value) throws CacheUnavailableException,CacheWriteException { try { ... } catch (SocketException e) { throw new CacheUnavailableException(e); } catch (SomeMemcacheException e) { throw new CacheWriteException(e); } } This will allow library clients to catch exceptions that mean something to them, not exceptions that only make sense if you know how the library is using memcache.