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:
RegisterErrorHandlernow requires a concrete instance of the error as its first argumentRegisterErrorHandlerOnnow requires a concrete instance of the error as its second argumentRegisterStringErrorHandlerhas been removed, use staticerrors.NewinRegisterErrorHandlerto get this to workRegisterStringErrorHandlerOnhas been removed, use staticerrors.NewinRegisterErrorHandlerOnto get this to workRegisterCustomErrorTypeHandlerhas been removed, wrap unexported errors from libraries to create handlers for theseRegisterCustomErrorTypeHandlerOnhas been removed, wrap unexported errors from libraries to create handlers for theseErrorRegistrychanges:DefaultCodehas been removed, useRegisterDefaultHandlerinsteadDefaultResponsehas been removed, useRegisterDefaultHandlerinsteadSetDefaultResponsehas been removed, useRegisterDefaultHandlerinstead
go get github.com/ing-bank/ginerr/v3
Check out the examples here.
- Clone the repository
- Run
make toolsto install necessary tools - Run
make fmtto format code - Run
make lintto lint your code
You can run make to see a list of useful commands.
Nothing here yet!