Documentation ¶
Index ¶
- func NewErrBadRequest(err error) render.Renderer
- func NewErrClientNotAuthorized(err error) render.Renderer
- func NewErrCreate(err error) render.Renderer
- func NewErrDBError(err error) render.Renderer
- func NewErrDelete(err error) render.Renderer
- func NewErrGenJSON(err error) render.Renderer
- func NewErrGeneratingToken(err error) render.Renderer
- func NewErrInternalServerError(err error) render.Renderer
- func NewErrInvalidRefreshToken(err error) render.Renderer
- func NewErrLoginUser(err error) render.Renderer
- func NewErrNotFound(err error) render.Renderer
- func NewErrParsingJSON(err error) render.Renderer
- func NewErrPatch(err error) render.Renderer
- func NewErrPermissionDeniedForAPIEndpoint(err error) render.Renderer
- func NewErrQueryParameter(err error) render.Renderer
- func NewErrReadingBody(err error) render.Renderer
- func NewErrTokenInvalid(err error) render.Renderer
- func NewErrURLParameter(err error) render.Renderer
- func NewErrUpdate(err error) render.Renderer
- func NewErrValidation(err error) render.Renderer
- func NewErrVerification(err error) render.Renderer
- func NewErrVerify(err error) render.Renderer
- func WriteBytes(w http.ResponseWriter, jsonBytes []byte)
- func WriteOK(w http.ResponseWriter)
- type ErrBadRequest
- type ErrClientNotAuthorized
- type ErrCreate
- type ErrDBError
- type ErrDelete
- type ErrGenJSON
- type ErrGeneratingToken
- type ErrInternalServerError
- type ErrInvalidRefreshToken
- type ErrLoginUser
- type ErrNotFound
- type ErrParsingJSON
- type ErrPatch
- type ErrPermissionDeniedForAPIEndpoint
- type ErrQueryParameter
- type ErrReadingBody
- type ErrResponse
- type ErrTokenInvalid
- type ErrURLParameter
- type ErrUpdate
- type ErrVerification
- type ErrVerify
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewErrBadRequest ¶
NewErrBadRequest creates a new ErrBadRequest
func NewErrClientNotAuthorized ¶
NewErrClientNotAuthorized creates a new ErrClientNotAuthorized
func NewErrCreate ¶
NewErrCreate creates a new ErrCreate
func NewErrDBError ¶
NewErrDBError creates a new ErrDBError
func NewErrDelete ¶
NewErrDelete creates a new ErrDelete
func NewErrGenJSON ¶
NewErrGenJSON creates a new ErrGenJSON
func NewErrGeneratingToken ¶
NewErrGeneratingToken creates a new ErrGeneratingToken
func NewErrInternalServerError ¶
NewErrInternalServerError presents error when refreshing a token
func NewErrInvalidRefreshToken ¶
NewErrInvalidRefreshToken presents error when refreshing a token
func NewErrLoginUser ¶
NewErrLoginUser creates a new ErrLoginUser
func NewErrNotFound ¶
NewErrNotFound creates a new ErrNotFound
func NewErrParsingJSON ¶
NewErrParsingJSON creates a new ErrParsingJSON
func NewErrPermissionDeniedForAPIEndpoint ¶
NewErrPermissionDeniedForAPIEndpoint creates a new ErrClientNotAuthorized
func NewErrQueryParameter ¶
NewErrQueryParameter creates a new ErrQueryParameter
func NewErrReadingBody ¶
NewErrReadingBody creates a new ErrReadingBody
func NewErrTokenInvalid ¶
NewErrTokenInvalid creates a new ErrTokenInvalid
func NewErrURLParameter ¶
NewErrURLParameter creates a new ErrURLParameter
func NewErrUpdate ¶
NewErrUpdate creates a new ErrUpdate
func NewErrValidation ¶
NewErrValidation presents validation errors This message is different
func NewErrVerification ¶
NewErrVerification creates a new ErrDelete
func NewErrVerify ¶
NewErrVerify creates a new ErrVerify
func WriteBytes ¶
func WriteBytes(w http.ResponseWriter, jsonBytes []byte)
WriteBytes writes code 0 and a content
Types ¶
type ErrBadRequest ¶
type ErrBadRequest struct {
ErrResponse
}
ErrBadRequest is on all type of errors
type ErrClientNotAuthorized ¶
type ErrClientNotAuthorized struct {
ErrResponse
}
ErrClientNotAuthorized is when client id or secret is not registered or wrong
type ErrDBError ¶
type ErrDBError struct {
ErrResponse
}
ErrDBError some problem operating with DB (maybe transaction)
type ErrDelete ¶
type ErrDelete struct {
ErrResponse
}
ErrDelete some problem deleting resource (not specific yet)
type ErrGenJSON ¶
type ErrGenJSON struct {
ErrResponse
}
ErrGenJSON is error parsing JSON and creating structs
type ErrGeneratingToken ¶
type ErrGeneratingToken struct {
ErrResponse
}
ErrGeneratingToken shows problem with generating key
type ErrInternalServerError ¶
type ErrInternalServerError struct {
ErrResponse
}
ErrInternalServerError some problem refreshing the token (maybe missing)
type ErrInvalidRefreshToken ¶
type ErrInvalidRefreshToken struct {
ErrResponse
}
ErrInvalidRefreshToken some problem refreshing the token (maybe missing)
type ErrLoginUser ¶
type ErrLoginUser struct {
ErrResponse
}
ErrLoginUser problem login user. Maybe the user doesn't exists.
type ErrNotFound ¶
type ErrNotFound struct {
ErrResponse
}
ErrNotFound resource cannot be found (record doesn't exist)
type ErrParsingJSON ¶
type ErrParsingJSON struct {
ErrResponse
}
ErrParsingJSON is error parsing JSON and creating structs
type ErrPatch ¶
type ErrPatch struct {
ErrResponse
}
ErrPatch some problem patching resource (not specific yet) This is not even called right now because not implemented
type ErrPermissionDeniedForAPIEndpoint ¶
type ErrPermissionDeniedForAPIEndpoint struct {
ErrResponse
}
ErrPermissionDeniedForAPIEndpoint is permission denied for this endpoint
type ErrQueryParameter ¶
type ErrQueryParameter struct {
ErrResponse
}
ErrQueryParameter is an error on the URL parameter
type ErrResponse ¶
type ErrResponse struct { Err error `json:"-"` // low-level runtime error HTTPStatusCode int `json:"-"` // http response status code StatusText string `json:"msg,omitempty"` // user-level status message Code int64 `json:"code,omitempty"` // application-specific error code ErrorText string `json:"error,omitempty"` // application-level error message, for debugging MoreInfo string `json:"moreInfo,omitempty"` // URL link }
Maybe take into consideration my original design
{ "error": "101", "developerMessage": "給開發者看的 message", "userMessage": "給使用者看的簡易 message", "moreInfo": "https://xyz.com/doc/errors/101" }
func (*ErrResponse) Render ¶
func (e *ErrResponse) Render(w http.ResponseWriter, r *http.Request) error
Render is to satisfy the render.Render interface
type ErrTokenInvalid ¶
type ErrTokenInvalid struct {
ErrResponse
}
ErrTokenInvalid token is not valid or expired
type ErrURLParameter ¶
type ErrURLParameter struct {
ErrResponse
}
ErrURLParameter is an error on the URL parameter
type ErrUpdate ¶
type ErrUpdate struct {
ErrResponse
}
ErrUpdate some problem updating resource (not specific yet)
type ErrVerification ¶
type ErrVerification struct {
ErrResponse
}
ErrVerification some problem regarding email verification
type ErrVerify ¶
type ErrVerify struct {
ErrResponse
}
ErrVerify some problem verifying email (not specific yet)