Re:Code Design Decision – Always throw custom exceptions
by hbrn on Monday December 19, 2022 @03:44PM
(#34057408)
Haha, that's actually a good point. A single problem can affect dozens of modules, each having a different wrapper.
If my db goes down, I very much prefer to see a single DatabaseConnectionFailed than a multitude of FailedToSaveObject, DatabaseError, CannotLoadData, IOError, SomethingIsWrongThisShouldNeverHappen, DBHostUnavailable all over the place. Good luck navigating through the noise and isolating those.
Re:Code Design Decision – Always throw custom exceptions
by eweise on Monday December 19, 2022 @05:41PM
(#34058826)
The article talks about solving that exact issue by wrapping all of those different exceptions so that you don't have to deal with them. Much easier to catch a single ThirdPartyInternalFailure exception than catch all the internal exceptions that could have caused an internal failure.
Re:Code Design Decision – Always throw custom exceptions
by Misdicorl on Monday December 19, 2022 @07:51PM
(#34060054)
When library 1 through 10 take this approach to wrapping a common exception you get the above behavior. Obviously a single library should have a coherent internal story
Re:Code Design Decision – Always throw custom exceptions
by z3t4 on Monday December 19, 2022 @03:55PM
(#34057567)
What do you use libraries for if not for the abstraction layer?
Re:Code Design Decision – Always throw custom exceptions
by P5fRxh5kUvp2th on Monday December 19, 2022 @04:26PM
(#34057943)
Well it certainly isn't so I don't have to understand what an ADO exception is.
I'm going to curse here, but ... fucking seriously.
If I get a .net ADO exception coming out of a 3rd party library it's absolutely not going to shock me or throw me for a loop. But do you know what IS a pain in the ass? Using 3 different libraries, all that wrap that same ADO exception in their own custom exception.