3 ms·
> Being able to express that a bunch of internal exceptions should be wrapped in an application exception would save a ton of boilerplate. It would but I think
by wvenable 7y ago
> Being able to express that a bunch of internal exceptions should be wrapped in an application exception would save a ton of boilerplate.
It would but I think it's the wrong approach -- you're actively changing the error information that really provides no additional value except to make the type-checker happy because the alternative is too verbose.
- asplake 7y agoDoesn’t wrapping usually mean adding (semantic) information without changing the original?
- wvenable 7y agoYou no longer propagating the same error; if you were type-checking on network exceptions, for example, you would entirely miss it if it was wrapped in LibraryException instead. Wrapping does have value if you are really adding useful information but the example here is just changing the type which really doesn't add anything useful.