Documentation
¶
Index ¶
- type AppError
- func BadRequest(message string) *AppError
- func Conflict(code, message string) *AppError
- func Forbidden(message string) *AppError
- func Internal(cause error) *AppError
- func New(status int, code, message string) *AppError
- func NotFound(entity, id string) *AppError
- func Unauthorized(message string) *AppError
- func ValidateEmail(email string) *AppError
- func ValidateName(field, value string) *AppError
- func ValidateSemver(value string) *AppError
- func ValidateSlug(value string) *AppError
- func ValidateURL(value string) *AppError
- func WithDetails(err *AppError, details any) *AppError
- func Wrap(status int, code, message string, cause error) *AppError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppError ¶
type AppError struct {
Code string // machine-readable: "LICENSE_NOT_FOUND", "ACTIVATION_LIMIT"
Message string // human-readable
Status int // HTTP status code
Details any // optional structured details
Cause error // underlying error (not exposed to clients)
}
AppError is the standard application error type. Handlers translate these into the appropriate HTTP status + response envelope.
func BadRequest ¶
func Unauthorized ¶
func ValidateEmail ¶
func ValidateName ¶
func ValidateSemver ¶ added in v0.1.1
ValidateSemver returns nil iff value is a strict SemVer 2.0 version string. Leading zeros (e.g. `01.0.0`), empty pre-release identifiers, and other 2.0 violations are rejected. Empty input is rejected — call sites that allow "no version" must short-circuit before calling.
func ValidateSlug ¶
func ValidateURL ¶
func WithDetails ¶
Click to show internal directories.
Click to hide internal directories.