Documentation
¶
Overview ¶
Package apperr provides a typed error that carries a stable, machine-readable code (and optional interpolation params) alongside a human-readable message.
The code lets the web frontend translate the error into the user's language via its i18n catalog, while the message remains a sensible fallback for any client that does not recognize the code.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Error ¶
type Error struct {
Code string
Message string
// Params carries interpolation values for the localized message
// (e.g. {"scope": "worker"}). Optional.
Params map[string]any
// contains filtered or unexported fields
}
Error is a business error with a stable code. The code is what the frontend maps to a localized string; Message is the (English) fallback.
func (*Error) WithParams ¶
WithParams attaches interpolation params and returns the error for chaining.