Documentation
¶
Overview ¶
Package oops is dev-idp's lightweight error helper. It mirrors enough of the surface from server/internal/oops for the service code to compile, minus the OTel hooks. Errors carry a Code (mapped to HTTP status) and a public message; .Log() emits via slog.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Code ¶
type Code string
const ( CodeBadRequest Code = "bad_request" CodeNotFound Code = "not_found" CodeConflict Code = "conflict" CodeForbidden Code = "forbidden" CodeInvalid Code = "invalid" CodeUnexpected Code = "unexpected" CodeGatewayError Code = "gateway_error" CodeInvariantViolation Code = "invariant_violation" CodeNotImplemented Code = "not_implemented" )
type ShareableError ¶
type ShareableError struct {
// contains filtered or unexported fields
}
ShareableError carries a public-facing message plus the cause. The cause is wrapped in the .Error() output so dev-idp's permissive error encoder can leak it to the browser.
func (*ShareableError) AsGoa ¶
func (e *ShareableError) AsGoa() *goa.ServiceError
AsGoa converts to a goa.ServiceError using the code as the name. The .Error() output (public + cause) becomes the response message body.
func (*ShareableError) Error ¶
func (e *ShareableError) Error() string
func (*ShareableError) HTTPStatus ¶
func (e *ShareableError) HTTPStatus() int
func (*ShareableError) Log ¶
func (e *ShareableError) Log(ctx context.Context, logger *slog.Logger, args ...slog.Attr) *ShareableError
Log emits a slog Error and returns the receiver for chaining.
func (*ShareableError) Unwrap ¶
func (e *ShareableError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.