Documentation
¶
Index ¶
- func Is(err error, target error) bool
- type ErrAttr
- type ErrCode
- type Error
- func (err Error) Code() ErrCode
- func (err Error) Error() string
- func (err Error) LocalizedError(tag LanguageTag) string
- func (e Error) MarshalJSON() ([]byte, error)
- func (err Error) Render(args ...any) Error
- func (err Error) SetLocaleMessage(tag LanguageTag, message string)
- func (err Error) SupportedTags() (tags []LanguageTag)
- type Errors
- type LangPackage
- type LanguageTag
- type YamlPackage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrAttr ¶
type ErrAttr struct {
Code ErrCode
Messages []LangPackage
}
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
var ( ErrBadRequest Error ErrPaymentRequired Error ErrForbidden Error ErrNotFound Error ErrMethodNotAllowed Error ErrNotAcceptable Error ErrProxyAuthRequired Error ErrRequestTimeout Error ErrConflict Error ErrGone Error ErrLengthRequired Error ErrPreconditionFailed Error ErrPayloadTooLarge Error ErrURITooLong Error ErrUnsupportedMediaType Error ErrRangeNotSatisfiable Error ErrExpectationFailed Error ErrIMTeapot Error ErrMisdirectedRequest Error ErrUnprocessableEntity Error ErrLocked Error ErrFailedDependency Error ErrTooEarly Error ErrUpgradeRequired Error ErrPreconditionRequired Error ErrTooManyRequests Error ErrInternalServerError Error ErrNotImplemented Error ErrBadGateway Error ErrBadGatewayf Error ErrGatewayTimeout Error ErrUnprocessable Error ErrHTTPVersionNotSupported Error ErrInsufficientStorage Error ErrRequired Error ErrBelowMinimum Error ErrAboveMaximum Error ErrMustBeEmail Error ErrMustBeDigit Error ErrMustBeAlphanum Error ErrMustBeAlphabet Error ErrLengthBelowMinimum Error ErrLengthAboveMaximum Error ErrInvalidDateFormat Error ErrInvalidDatetimeFormat Error ErrUnsupportedDataType Error ErrInvalidParameter Error ErrMustBeName Error ErrMustBeText Error ErrMustBeOneOf Error ErrUnsupportedContentType Error ErrCannotBeNull Error ErrTypeMismatch Error ErrInvalidNumericFormat Error ErrInvalidFloatNumber Error ErrInvalidIntegerNumber Error )
func (Error) LocalizedError ¶
func (err Error) LocalizedError(tag LanguageTag) string
func (Error) MarshalJSON ¶
MarshalJSON returns the error as a JSON string
func (Error) SetLocaleMessage ¶
func (err Error) SetLocaleMessage(tag LanguageTag, message string)
func (Error) SupportedTags ¶
func (err Error) SupportedTags() (tags []LanguageTag)
type Errors ¶
func (Errors) LocalizedError ¶
func (errs Errors) LocalizedError(tag LanguageTag) map[string]any
type LangPackage ¶
type LangPackage struct {
Tag LanguageTag
Message string
}
type LanguageTag ¶
type LanguageTag string
var ( Bahasa LanguageTag = LanguageTag(language.Indonesian.String()) English LanguageTag = LanguageTag(language.English.String()) DefaultLocale = English )
type YamlPackage ¶
type YamlPackage struct {
Errors map[string]map[LanguageTag]string `yaml:"errors"`
Packages map[string]ErrAttr
}
func NewYamlPackage ¶
func NewYamlPackage() YamlPackage
func (*YamlPackage) LoadBytes ¶ added in v0.1.9
func (raw *YamlPackage) LoadBytes(yamlBytes []byte) error
func (*YamlPackage) LoadYaml ¶
func (raw *YamlPackage) LoadYaml(filename string) error
func (YamlPackage) NewError ¶
func (yml YamlPackage) NewError(key string) Error
Click to show internal directories.
Click to hide internal directories.