Versions in this module Expand all Collapse all v1 v1.0.1 Aug 15, 2024 Changes in this version + func ErrResp(e error) (httpserver.Responser, error) + func ErrWrite(e error, w http.ResponseWriter) error + func Error(rw http.ResponseWriter, err error) + func IsNotFound(e error) bool + type APIError struct + func New(options ...Option) *APIError + func (e *APIError) AccessDenied(err ...interface{}) *APIError + func (e *APIError) AlreadyExists() *APIError + func (e *APIError) AppendAuthorizedRoles(roles []string) *APIError + func (e *APIError) Code() string + func (e *APIError) Ctx() interface{} + func (e *APIError) Error() string + func (e *APIError) ErrorVerificationCode(err error) *APIError + func (e *APIError) HttpCode() int + func (e *APIError) InternalError(err error) *APIError + func (e *APIError) InvalidParameter(err interface{}) *APIError + func (e *APIError) InvalidState(err string) *APIError + func (e *APIError) MissingParameter(err string) *APIError + func (e *APIError) NotFound() *APIError + func (e *APIError) NotLogin() *APIError + func (e *APIError) Render(localeResource *i18n.LocaleResource) string + func (e *APIError) SetCtx(ctx interface{}) *APIError + func (e *APIError) ToResp() httpserver.Responser + func (e *APIError) Write(w http.ResponseWriter) error + type MetaMessage struct + Args []interface{} + Default string + Key string + type Option func(*APIError) + func WithCode(httpCode int, code string) Option + func WithCtx(ctx interface{}) Option + func WithMessage(msg string) Option + func WithTemplateMessage(template, defaultValue string, args ...interface{}) Option