Versions in this module Expand all Collapse all v0 v0.2.0 Feb 27, 2026 v0.1.1 Feb 24, 2026 Changes in this version + const ErrCodeBadRequest + const ErrCodeBindFailed + const ErrCodeBusinessLogic + const ErrCodeConflict + const ErrCodeDatabase + const ErrCodeDuplicate + const ErrCodeExternalService + const ErrCodeFileUpload + const ErrCodeForbidden + const ErrCodeInternalServer + const ErrCodeNotFound + const ErrCodeRateLimitExceeded + const ErrCodeRouteNotFound + const ErrCodeStorageService + const ErrCodeTimeout + const ErrCodeTooManyRequests + const ErrCodeUnauthorized + const ErrCodeValidationFailed + var ErrBadRequest = NewError(ErrCodeBadRequest, "") + var ErrBindFailed = NewError(ErrCodeBindFailed, "") + var ErrBusinessLogic = NewError(ErrCodeBusinessLogic, "") + var ErrConflict = NewError(ErrCodeConflict, "") + var ErrDatabase = NewError(ErrCodeDatabase, "") + var ErrDuplicate = NewError(ErrCodeDuplicate, "") + var ErrExternalService = NewError(ErrCodeExternalService, "") + var ErrFileUpload = NewError(ErrCodeFileUpload, "") + var ErrForbidden = NewError(ErrCodeForbidden, "") + var ErrInternalServer = NewError(ErrCodeInternalServer, "") + var ErrNotFound = NewError(ErrCodeNotFound, "") + var ErrRouteNotFound = NewError(ErrCodeRouteNotFound, "") + var ErrStorageService = NewError(ErrCodeStorageService, "") + var ErrTimeout = NewError(ErrCodeTimeout, "") + var ErrTooManyRequests = NewError(ErrCodeTooManyRequests, "") + var ErrUnauthorized = NewError(ErrCodeUnauthorized, "") + var ErrValidationFailed = NewError(ErrCodeValidationFailed, "") + func BadRequest(w http.ResponseWriter, r *http.Request, message string, opts ...Option) + func BindError(w http.ResponseWriter, r *http.Request, details any, opts ...Option) + func Conflict(w http.ResponseWriter, r *http.Request, message string, opts ...Option) + func Created(w http.ResponseWriter, r *http.Request, data any, opts ...Option) + func CustomError(w http.ResponseWriter, r *http.Request, status int, code int, message string, ...) + func DatabaseError(w http.ResponseWriter, r *http.Request, message string, opts ...Option) + func DefaultPanicFn(w http.ResponseWriter, r *http.Request, err error) + func Forbidden(w http.ResponseWriter, r *http.Request, message string, opts ...Option) + func GetErrorMessage(code int) string + func InternalServerError(w http.ResponseWriter, r *http.Request, message string, opts ...Option) + func NoContent(w http.ResponseWriter, r *http.Request, opts ...Option) + func NotFound(w http.ResponseWriter, r *http.Request, message string, opts ...Option) + func OK(w http.ResponseWriter, r *http.Request, data any, opts ...Option) + func ServiceUnavailable(w http.ResponseWriter, r *http.Request, message string, opts ...Option) + func TooManyRequests(w http.ResponseWriter, r *http.Request, message string, opts ...Option) + func Unauthorized(w http.ResponseWriter, r *http.Request, message string, opts ...Option) + func ValidationError(w http.ResponseWriter, r *http.Request, details any, opts ...Option) + func Write(w http.ResponseWriter, r *http.Request, status int, data any, opts ...Option) + func WriteError(w http.ResponseWriter, r *http.Request, status int, err Error, opts ...Option) + func WriteList(w http.ResponseWriter, r *http.Request, status int, data any, ...) + type Error struct + Code int + Details any + Message string + func NewError(code int, message string) Error + func NewErrorWithDetails(code int, message string, details any) Error + type ErrorConfig struct + Code int + HTTPStatus int + Message string + type FactoryOption func(*ResponderFactory) + func WithCustomErrors(errors map[int]*ErrorConfig) FactoryOption + func WithPanicFn(panicFn PanicFn) FactoryOption + type FieldError struct + Field string + Message string + type Meta struct + Pagination *PaginationMeta + Took int64 + TraceId string + func NewMeta(opts ...Option) *Meta + type Option func(*Meta) + func WithPagination(p *PaginationMeta) Option + func WithTook(ms int64) Option + func WithTraceID(id string) Option + type PaginationMeta struct + HasMore bool + Page int + PageSize int + Total int64 + TotalPages int + type PanicFn func(http.ResponseWriter, *http.Request, error) + type Responder struct + func New(w http.ResponseWriter, r *http.Request, panicFn PanicFn) *Responder + func (r *Responder) BadRequest(message string, opts ...Option) + func (r *Responder) BindError(details any, opts ...Option) + func (r *Responder) Conflict(message string, opts ...Option) + func (r *Responder) Created(data any, opts ...Option) + func (r *Responder) CustomError(status int, code int, message string, details any, opts ...Option) + func (r *Responder) DatabaseError(message string, opts ...Option) + func (r *Responder) Forbidden(message string, opts ...Option) + func (r *Responder) GetCustomError(code int) *ErrorConfig + func (r *Responder) InternalServerError(message string, opts ...Option) + func (r *Responder) NoContent(opts ...Option) + func (r *Responder) NotFound(message string, opts ...Option) + func (r *Responder) OK(data any, opts ...Option) + func (r *Responder) ServiceUnavailable(message string, opts ...Option) + func (r *Responder) TooManyRequests(message string, opts ...Option) + func (r *Responder) Unauthorized(message string, opts ...Option) + func (r *Responder) ValidationError(details any, opts ...Option) + func (r *Responder) Write(status int, payload any, opts ...Option) + func (r *Responder) WriteError(status int, err Error, opts ...Option) + func (r *Responder) WriteList(status int, payload any, pager *PaginationMeta, opts ...Option) + type ResponderFactory struct + func NewResponderFactory(opts ...FactoryOption) *ResponderFactory + func (f *ResponderFactory) FromRequest(w http.ResponseWriter, r *http.Request) *Responder + type Response struct + Data any + Error *Error + Meta Meta v0.1.0 Feb 21, 2026