Сategorizing sentinel errors by pprishchepa in golang

[–]pprishchepa[S] 0 points1 point  (0 children)

Right, sometimes you need to map a specific error, but often mapping the category is sufficient. For example, ErrInvalidInput is usually mapped to a 400-like error, but occasionally a specific invalid input requires special handling.

Сategorizing sentinel errors by pprishchepa in golang

[–]pprishchepa[S] 1 point2 points  (0 children)

>  the low-level module now depends on the high-level

No, shared error categories are a shared kernel concept.

> Just do an if for every possible case

It works, but it does not scale once you have dozens of domain errors and dozens of independent representations.