Give callers two error types, one extending the other
A single catch-all exception forces every call site to over-handle. Two types in a hierarchy let each caller pick its own granularity.
#Java#Error Handling#API Design
Shorter takes on engineering practice, tooling, hiring, and building in startups. Some are a paragraph.
Short, personal, and opinionated. The longer, structured writing is on the Blog .
A single catch-all exception forces every call site to over-handle. Two types in a hierarchy let each caller pick its own granularity.
Typed response structs are the default advice. For a one-person library wrapping a churny upstream API, `(any, error)` was the cheaper long-term choice.
Subscribe: RSS