4 ms·
Funny you’re mentioning that exact book. I almost put it as the source in my original comment, but maybe I remember wrong. What I remember is the “deep interfa
by diarrhea 3y ago
Funny you’re mentioning that exact book. I almost put it as the source in my original comment, but maybe I remember wrong.
What I remember is the “deep interfaces” advice, which is great. It encourages small surfaces but deep implementations. Hiding the potentially large list of raisable exceptions helps in keeping an interface or API small. Errors are handled transparently and the user only needs to deal with those they know how to handle. What good is it to raise a deep error that by the time it reaches the top levels (like a web servers middleware loop), it can no longer be handled reasonably and has to be thrown? That’s why, if you can handle it, do so ASAP.
That’s what I remember from that book. Again, perhaps I’m misremembering.