DEV Community

Discussion on: Only 2 or 3 error types are needed

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

Yes, at first the multiple errors seem like a good idea, but then something screws them up. Somebody misuses a code, the code is lost in propagation, or it replaces and hides another failure.

Most likely the error code distignuished the errors at some point. But then a defect was discovered. More error codes were checked. Repeat. Eventually somebody just decided that it'd be easier to just handle any error the same way. It may not be optimal, but it had the best chance of working consistently.

It's not the type of error that decides how to handle it, it's where and when it occurs.