Documentation
¶
Index ¶
- Variables
- func AsType[E error](err error) (E, bool)
- func ErrorCodef(code StatusCode, format string, args ...any) error
- func ErrorMessage(code StatusCode, message string) error
- func ErrorMessagef(code StatusCode, message string, args ...any) error
- func ErrorPayload(code StatusCode, payload any) error
- func Errorf(format string, args ...any) error
- func FailJSON(w http.ResponseWriter, r *http.Request, err error)
- func HTTPCode(code StatusCode) int
- func HTTPCodeMessage(code StatusCode, message string) (int, string)
- func HasStack(err error) bool
- func HelperErrorf(format string, args ...any) error
- func Payload(err error) any
- func WithCode(code StatusCode, message string, cause error) error
- func WithCodeStack(code StatusCode, message string, cause error) error
- func WithStack(err error) error
- type StatusCode
Constants ¶
This section is empty.
Variables ¶
View Source
var As = errors.As
View Source
var Is = errors.Is
View Source
var Join = errors.Join
View Source
var New = errors.New
View Source
var Unwrap = errors.Unwrap
Functions ¶
func ErrorCodef ¶ added in v0.0.2
func ErrorCodef(code StatusCode, format string, args ...any) error
Error with a code and internal message.
func ErrorMessage ¶ added in v0.0.2
func ErrorMessage(code StatusCode, message string) error
func ErrorMessagef ¶ added in v0.0.2
func ErrorMessagef(code StatusCode, message string, args ...any) error
Error with a publicly visible message.
func ErrorPayload ¶ added in v0.0.2
func ErrorPayload(code StatusCode, payload any) error
Error with a payload.
func HTTPCode ¶ added in v0.0.2
func HTTPCode(code StatusCode) int
func HTTPCodeMessage ¶ added in v0.0.2
func HTTPCodeMessage(code StatusCode, message string) (int, string)
func HelperErrorf ¶ added in v0.0.2
func WithCodeStack ¶ added in v0.0.2
func WithCodeStack(code StatusCode, message string, cause error) error
Types ¶
type StatusCode ¶ added in v0.0.2
type StatusCode int
const ( StatusUnknown StatusCode = iota StatusCanceled StatusInvalidArgument StatusDeadlineExceeded StatusInternal StatusNotFound StatusUnauthenticated StatusPermissionDenied StatusAlreadyExists StatusFailedPrecondition StatusUnimplemented )
Union of HTTP status codes & https://grpc.github.io/grpc/core/md_doc_statuscodes.html If you add a value here, search for all switches on this enum.
func Code ¶ added in v0.0.2
func Code(err error) (StatusCode, string)
func Status ¶ added in v0.0.2
func Status(err error) StatusCode
Click to show internal directories.
Click to hide internal directories.