Documentation
¶
Index ¶
- type Error
- func BadGateway(opts ...Option) *Error
- func BadRequest(opts ...Option) *Error
- func Errorf(message string, args ...any) *Error
- func Forbidden(opts ...Option) *Error
- func FromError(src error) (dst *Error, ok bool)
- func FromProto(src *pbrpc.Error) *Error
- func FromStatus(src *status.Status) (dst *Error, ok bool)
- func Internal(opts ...Option) *Error
- func New(opts ...Option) (err *Error)
- func NotFound(opts ...Option) *Error
- func Parse(message string) (dst *Error, ok bool)
- func Unauthorized(opts ...Option) *Error
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
An internal Error details
func BadGateway ¶
(#502) BAD_GATEWAY
New(
Status("BAD_GATEWAY"),
Code(http.StatusBadGateway),
opts...,
)
func BadRequest ¶
(#400) BAD_REQUEST
New(
Status("BAD_REQUEST"),
Code(http.StatusBadRequest),
opts...,
)
func FromStatus ¶
FromStatus type conversion method
func Internal ¶
(#500) INTERNAL
New(
Status("INTERNAL"),
Code(http.StatusInternalServerError),
opts...,
)
func Parse ¶
Parse tries to parse a JSON string into an error. If that fails, it will set the given string as the error detail.
func Unauthorized ¶
(#401) UNAUTHORIZED
New(
Status("UNAUTHORIZED"),
Code(http.StatusUnauthorized),
opts...,
)
func (*Error) GRPCStatus ¶
GRPCStatus returns the [grpc.Status] represented by [e]. Compatibility for grpc/status.FromError() method.
Click to show internal directories.
Click to hide internal directories.