Documentation ¶
Index ¶
- Constants
- Variables
- func GraphQLError(message string, requestID string) error
- func GraphQLInternalError(originalError error, requestID string) error
- func JSON(c *gin.Context, code int, obj interface{})
- func JSONAbort(c *gin.Context, code int, obj interface{})
- func RecoveryHandler(c *gin.Context, err interface{})
- func RenderInternalError(c *gin.Context, code int, obj interface{}) (int, interface{})
- type Error
- type RequestError
- type RequestInternalError
- type Success
Constants ¶
View Source
const ( InternalError = 100000 InputValidationError = 100001 )
Variables ¶
View Source
var ( PathUsername = "data.username" PathPassword = "data.password" PathEmail = "data.email" UsernameExists = "username already exists" UsernameTooShort = "username too short" EmailExists = "email address already exists" EmailIncorrect = "email address incorrect" PasswordTooShort = "password too short" WrongUsernamePassword = "wrong username or password" UserInactive = "user is inactive" InsufficientPermissionOrNonExistentResource = "user has insufficient permissions for this action or the resource does not exist" )
Functions ¶
func GraphQLError ¶
func GraphQLInternalError ¶
func JSON ¶
JSON serializes the given struct as JSON into the response body. It also sets the Content-Type as "application/json".
func RecoveryHandler ¶
Types ¶
type Error ¶
type Error struct { Result string `json:"Result" description:"Whether the call was successful." enum:"success,error"` ErrorCode int `json:"Code" description:"The code of the error."` ErrorMessage string `json:"Message" description:"The human message of the error."` RequestId string `json:"RequestId" description:"A request ID for support and debugging purposes."` }
The serializable Error structure.
type RequestError ¶
func (RequestError) Error ¶
func (r RequestError) Error() string
type RequestInternalError ¶
func (RequestInternalError) Error ¶
func (r RequestInternalError) Error() string
Click to show internal directories.
Click to hide internal directories.