Categorygithub.com/toretto460/ginerr
modulepackage
0.1.0
Repository: https://github.com/toretto460/ginerr.git
Documentation: pkg.go.dev

# README

Gin Err

Gin err provides a convenient way to transform an internal application error into an HTTP JSON response with the following fields:

  • code: the internal error code
  • message: the internal error message

Furthermore the HTTP status code can be easily mapped to the internal error by providing a translation map as follows

AutoResponse(map[int]int{
  5001: 500,
  5002: 404,
  5003: 401,
})

# Functions

AutoResponse automatically sends an HTTP response if there is an error in the gin.Context.