Versions in this module Expand all Collapse all v0 v0.0.7 Sep 1, 2023 v0.0.6 Sep 1, 2023 Changes in this version + const Version v0.0.5 Sep 1, 2023 v0.0.4 Aug 31, 2023 Changes in this version type HTTPErrorResponse + func Unauthorized() HTTPErrorResponse v0.0.3 Aug 31, 2023 v0.0.2 Aug 31, 2023 Changes in this version type HTTPErrorResponse + func Forbidden() HTTPErrorResponse v0.0.1 Aug 31, 2023 Changes in this version + var ReasonGroups map[int]ReasonGroup = map[int]ReasonGroup + var Reasons map[ReasonCode]Reason = map[ReasonCode]Reason + func Extend(typeURI string, title string, status int) + func FromError(err error) []validationError + func Generate() + type Blunder struct + func New() *Blunder + func NewRFC() *Blunder + func NewWithOptions(options BlunderOptions) *Blunder + func (b *Blunder) Add(r *http.Request, err error) + func (b *Blunder) AddCustomerError(customerError CustomError) + func (b *Blunder) BindJson(r *http.Request, payload interface{}) []validationError + func (b *Blunder) Enrich(httpErr HTTPError) HTTPError + func (b *Blunder) ErrorHandler(logger Logger) Middleware + func (b *Blunder) FromValidator(errs validator.ValidationErrors, locale string) []validationError + func (b *Blunder) Get(r *http.Request) []error + func (b *Blunder) GinAdd(c *gin.Context, err error) + func (b *Blunder) GinErrorHandler(logger Logger) gin.HandlerFunc + func (b *Blunder) GinGet(c *gin.Context) []error + func (b *Blunder) GinNoMethod(c *gin.Context) + func (b *Blunder) GinNoRoute(c *gin.Context) + func (b *Blunder) GinRecovery(c *gin.Context, err any) + func (b *Blunder) HandleErrors(r *http.Request, errs []error) (int, HTTPErrorResponse, bool) + func (b *Blunder) Html(c *gin.Context) + func (b *Blunder) RegisterCustomTranslation(tag string, trans ut.Translator, registerFn validator.RegisterTranslationsFunc, ...) error + func (b *Blunder) RegisterCustomValidation(tag string, fn validator.Func, callValidationEvenIfNull ...bool) error + func (b *Blunder) SetEnvironment(environment Environment) + type BlunderOptions struct + Domain string + Environment Environment + IsIdentifiable bool + IsRecovarable bool + IsTimeable bool + IsTraceable bool + TypeURI string + type CustomError interface + Code func() int + Recovarable func() bool + ShouldAbort func() bool + WithTitle func() string + type Data struct + ErrorCodes []ErrorCode + type DefaultError interface + ToHTPPError func() HTTPError + type Environment int + const Development + const Production + const Test + type ErrorCode struct + Code int + Description string + Message string + Reason string + Resolution string + Status string + Tip string + Title string + type HTTPError struct + Action string + Argument string + Detail string + Expression string + Field string + Placement string + Reason string + ReasonCode int + StackTrace string + Title string + Type string + func (e HTTPError) Error() string + type HTTPErrorResponse struct + CorrelationId string + Domain string + Errors []HTTPError + Instance string + Language string + Recoverable bool + Status int + Timestamp int + TraceId string + func BadRequest() HTTPErrorResponse + func FromHTTPError(status int, errs ...HTTPError) HTTPErrorResponse + func InternalServerError() HTTPErrorResponse + func MethodNotAllowed() HTTPErrorResponse + func NewHTTPErrorResponse(status int, message string) HTTPErrorResponse + func NotFound() HTTPErrorResponse + func NotImpemented() HTTPErrorResponse + func ServiceUnavailable() HTTPErrorResponse + func (r HTTPErrorResponse) ToJson() []byte + func (r HTTPErrorResponse) WithCorrelation(id string) HTTPErrorResponse + func (r HTTPErrorResponse) WithDomain(domain string) HTTPErrorResponse + func (r HTTPErrorResponse) WithInstance(instance string) HTTPErrorResponse + func (r HTTPErrorResponse) WithLanguage(language string) HTTPErrorResponse + func (r HTTPErrorResponse) WithStatus(status int) HTTPErrorResponse + func (r HTTPErrorResponse) WithTimestamp() HTTPErrorResponse + func (r HTTPErrorResponse) WithTrace() HTTPErrorResponse + type Logger interface + Error func(err error) + type Middleware func(http.HandlerFunc) http.HandlerFunc + type Reason struct + Message string + ReasonGroup ReasonGroup + Tip string + type ReasonCode int + const ACCESS_NOT_CONFIGURED + const ACCOUNT_DELETED + const ACCOUNT_DISABLED + const ACCOUNT_UNVERIFIED + const AUTHORIZATION_ERROR + const AUTH_REQUIRED + const BAD_CONTENT + const CONCURRENT_LIMIT_EXCEEDED + const CORS_REQUEST_WITH_XORIGIN + const DAILY_LIMIT_EXCEEDED + const ENDPOINT_CONSTRAINT_MISMATCH + const EXPIRED + const INSUFFICIENT_AUTHORIZED_PARTY + const INVALID + const INVALID_HEADER + const INVALID_PARAMETER + const INVALID_QUERY + const KEY_EXPIRED + const KEY_INVALID + const LIMIT_EXCEEDED + const NOT_DOWNLOAD + const NOT_UPLOAD + const PARSE_ERROR + const QUOTA_EXCEEDED + const RATE_LIMIT_EXCEEDED + const REQUIRED + const RESPONSE_TOO_LARGE + const SERVING_LIMIT_EXCEEDED + const SLL_REQUIRED + const TOO_MANY_PARTS + const UNKNOWN_API + const UNSUPPORTED_MEDIA_PROTOCOL + const UNSUPPORTED_OUTPUT_FORMAT + const USER_RATE_LIMIT_EXCEEDED + func (reasonCode ReasonCode) String() string + type ReasonGroup struct + Description string + Resolution string + Status int + Title string + type RecordNotFoundError struct + Identifier string + Name string + func (e RecordNotFoundError) Code() int + func (e RecordNotFoundError) Error() string + func (e RecordNotFoundError) Recovarable() bool + func (e RecordNotFoundError) ShouldAbort() bool + func (e RecordNotFoundError) ToHTPPError() HTTPError + func (e RecordNotFoundError) WithTitle() string + type ResourceAlreadyExistsError struct + Identifier string + Name string + func (e ResourceAlreadyExistsError) Code() int + func (e ResourceAlreadyExistsError) Error() string + func (e ResourceAlreadyExistsError) ShouldAbort() bool + func (e ResourceAlreadyExistsError) ToHTPPError() HTTPError