Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapperHandler ¶
func WrapperHandler(handlerFunc HandlerFunc) http.HandlerFunc
Types ¶
type ErrorResponse ¶
type ErrorResponse struct { ErrorCode string `json:"error_code"` ErrorMessage string `json:"error_message"` ErrorParams map[string]interface{} `json:"error_params"` // contains filtered or unexported fields }
ErrorResponse container status code and error code message, it will encode to a json string and add to http body
func NewErrorRes ¶
func NewErrorRes(statusCode int) *ErrorResponse
NewErrorRes creates a instance of ErrorResponse
func (*ErrorResponse) Error ¶
func (er *ErrorResponse) Error() string
Error implements error interface
func (*ErrorResponse) WithMsg ¶
func (er *ErrorResponse) WithMsg(errMsg string) *ErrorResponse
WithMsg add error message
func (*ErrorResponse) WithParam ¶
func (er *ErrorResponse) WithParam(key string, value interface{}) *ErrorResponse
WithParam add error parameters with key and value
type HandlerFunc ¶
type HandlerFunc func(http.ResponseWriter, *http.Request) error
HandlerFunc is http handler function return error
Click to show internal directories.
Click to hide internal directories.