3 ms·
I often wrap checked exceptions in lower level code in higher level checked exceptions. So if I was reading a configuration file I would throw something like Co
by adingwall 17y ago
I often wrap checked exceptions in lower level code in higher level checked exceptions.
So if I was reading a configuration file I would throw something like ConfigurationReadException and then wrap the IOException in this. Then if I switch to reading the configuration file from a database (for example), I can wrap an SQLException instead of the IOException. Encapsulation isn't broken and I still have checked exceptions.