Errors package is a drop-in replacement of the built-in Go errors package with no external dependencies. It lets you create errors of 11 different types which should handle most of the use cases. Some of them are a bit too specific for web applications, but useful nonetheless. Following are the primary features of this package:
- Multiple (11) error types
- User friendly message
- File & line number prefixed to errors
- HTTP status code and user friendly message (wrapped messages are concatenated) for all error types
In case of nested errors, the messages (in case of nesting with this package's error) & errors are also looped through. The limited no.of error types are only because I assumed too many options and too much customization might lead to some kind of fatigue. Tried making things a bit easier.
Errors package is a drop-in replacement of the built-in Go errors package with no external dependencies. It lets you create errors of 11 different types which should handle most of the use cases. Some of them are a bit too specific for web applications, but useful nonetheless. Following are the primary features of this package:
- Multiple (11) error types
- User friendly message
- File & line number prefixed to errors
- HTTP status code and user friendly message (wrapped messages are concatenated) for all error types
In case of nested errors, the messages (in case of nesting with this package's error) & errors are also looped through. The limited no.of error types are only because I assumed too many options and too much customization might lead to some kind of fatigue. Tried making things a bit easier.