apperror

package
v0.0.0-...-b3fa071 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package apperror defines the errors that may cross the HTTP boundary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromStorage

func FromStorage(err error) error

FromStorage maps known PostgreSQL outcomes while hiding SQL details.

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error contains only a safe client-facing code and message. The underlying cause is retained for errors.Is/As but is never returned in an HTTP response.

func Conflict

func Conflict(message string) *Error

func Forbidden

func Forbidden(code, message string) *Error

func Internal

func Internal(cause error) *Error

func Invalid

func Invalid(code, message string) *Error

func NotFound

func NotFound(message string) *Error

func Public

func Public(err error) *Error

Public returns a safe typed error for the HTTP responder, even if a caller accidentally passes a raw storage error.

func Unauthorized

func Unauthorized(code, message string) *Error

func (*Error) Code

func (e *Error) Code() string

func (*Error) Error

func (e *Error) Error() string

func (*Error) Message

func (e *Error) Message() string

func (*Error) Status

func (e *Error) Status() int

func (*Error) Unwrap

func (e *Error) Unwrap() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL