3 ms·
I'm trying to describe a rather large spectrum of situations, and how most of them are favorable (or not unfavorable) to anyhow. I'm not saying the error domai
by athrowaway3z 10mo ago
I'm trying to describe a rather large spectrum of situations, and how most of them are favorable (or not unfavorable) to anyhow.
I'm not saying the error domain is small per se.
Instead, one argument I'm making: what you're describing about errors bubbling up to the top layer, is what happens with the overwhelming majority of errors in my experience.
Whether the error space is large or small, just wait until you have an immediate need to treat one error different from the rest. It happens, it's just not common.
I didn't steelman the case for when to use enums, but in short: In a tiny error space or as valuable documentation.
(The doc value is undermined somewhat when projects use 1-big-error and functions that eg only returns 3 of the 6 possible errors)
I'm not advocating removing an Error enum. Just that writing one can and should be postponed, saving a lot of maintenance edits.
- zaphar 10mo agowhat you're describing about errors bubbling up to the top layer, is what happens with the overwhelming majority of errors in my experience. I agree that this is what happens in practice for most code that I read and have to interact with. I think where I differ from you is that I don't think this is good and do not advise people to do this for their own code. I think it's a pervasive but bad practice in our line of work.