Documentation
¶
Index ¶
Constants ¶
View Source
const ( // 400 BadRequest = "Bad Request" RequestValidationFailed = "request validation failed" EmailIsWrong = "email is wrong" PasswordIsWrong = "password is wrong" PermissionIsRepeat = "permission is repeat" Unauthorized = "Unauthorized" // 403 Forbidden = "Forbidden" // 500 InternalServerError = "Internal Server Error" ServiceUnavailable = "Service Unavailable" )
Variables ¶
View Source
var MessageToCode = map[string]string{ BadRequest: "400-001", RequestValidationFailed: "400-002", EmailIsWrong: "400-003", PasswordIsWrong: "400-004", PermissionIsRepeat: "400-005", Unauthorized: "401-001", Forbidden: "403-001", InternalServerError: "500-001", ServiceUnavailable: "503-001", }
Functions ¶
This section is empty.
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
Message string `json:"message" validate:"required"`
Code string `json:"code" validate:"required"`
Debug *Debug `json:"debug,omitempty"`
Context map[string]any `json:"context,omitempty"`
// contains filtered or unexported fields
}
func NewErrorResponse ¶
func NewErrorResponse(message string, err error, context map[string]any) *ErrorResponse
func (*ErrorResponse) MakeLogFields ¶
func (*ErrorResponse) StatusCode ¶
func (er *ErrorResponse) StatusCode() int
Click to show internal directories.
Click to hide internal directories.