Sending any error back to the user can pose a big security risk. For this reason we developed an error registry that allows you to register specific error handlers for your application. This way you can control what information is sent back to the user.
V3 completely revamps the ErrorRegistry
and now utilises the errors
package to match errors.
The following changes have been made:
RegisterErrorHandler
now requires a concrete instance of the error as its first argumentRegisterErrorHandlerOn
now requires a concrete instance of the error as its second argumentRegisterStringErrorHandler
has been removed, use staticerrors.New
inRegisterErrorHandler
to get this to workRegisterStringErrorHandlerOn
has been removed, use staticerrors.New
inRegisterErrorHandlerOn
to get this to workRegisterCustomErrorTypeHandler
has been removed, wrap unexported errors from libraries to create handlers for theseRegisterCustomErrorTypeHandlerOn
has been removed, wrap unexported errors from libraries to create handlers for theseErrorRegistry
changes:DefaultCode
has been removed, useRegisterDefaultHandler
insteadDefaultResponse
has been removed, useRegisterDefaultHandler
insteadSetDefaultResponse
has been removed, useRegisterDefaultHandler
instead
go get github.com/ing-bank/ginerr/v3
Check out the examples here.
- Clone the repository
- Run
make tools
to install necessary tools - Run
make fmt
to format code - Run
make lint
to lint your code
You can run make
to see a list of useful commands.
Nothing here yet!