Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ContentTypeApplicationJson = &header{ Key: "Content-Type", Value: []string{"application/json"}, } ContentTypeText = &header{ Key: "Content-Type", Value: []string{"text/plain; charset=utf-8"}, } )
Functions ¶
func ErrEncoder ¶
func ErrEncoder(w http.ResponseWriter, e Error)
Encoder encode the error response which sends to the client
func NewHeader ¶
NewHeader returns a pointer to header with given key and values which can be passed to http response
func WithHeader ¶
func WithHeader(h ...*header) (out []*header)
Types ¶
type Error ¶
type Error struct { // Error code to be send to the client // ex:- http.StatusOk Code int `json:"-"` // Mgs is the descriptive error message sent to the client Mgs string `json:"message"` // AppErrorCode is the application specific error code which is // documented against all the possible errors AppErrorCode int `json:"app_error_code"` // Actual error occured Error error `json:"-"` }
Error is the error message response object which will be sent to the client on event of any error
Click to show internal directories.
Click to hide internal directories.