Documentation ¶
Index ¶
- Constants
- Variables
- func CustomErrorHandler(ctx context.Context, gtw *runtime.ServeMux, runtimeMarshaler runtime.Marshaler, ...)
- func Equals(err1, err2 error) bool
- func Logger(err error) *zerolog.Logger
- type AsertoError
- func (e *AsertoError) Bool(key string, value bool) *AsertoError
- func (e *AsertoError) Cause() error
- func (e *AsertoError) Copy() *AsertoError
- func (e *AsertoError) Ctx(ctx context.Context) error
- func (e *AsertoError) Data() map[string]string
- func (e *AsertoError) Duration(key string, value time.Duration) *AsertoError
- func (e *AsertoError) Err(err error) *AsertoError
- func (e *AsertoError) Error() string
- func (e *AsertoError) Fields() map[string]interface{}
- func (e *AsertoError) FromReader(key string, value io.Reader) *AsertoError
- func (e *AsertoError) GRPCStatus() *status.Status
- func (e *AsertoError) Int(key string, value int) *AsertoError
- func (e *AsertoError) Int32(key string, value int32) *AsertoError
- func (e *AsertoError) Int64(key string, value int64) *AsertoError
- func (e *AsertoError) Interface(key string, value interface{}) *AsertoError
- func (e *AsertoError) MarshalZerologObject(event *zerolog.Event)
- func (e *AsertoError) Msg(message string) *AsertoError
- func (e *AsertoError) Msgf(message string, args ...interface{}) *AsertoError
- func (e *AsertoError) SameAs(err error) bool
- func (e *AsertoError) Str(key, value string) *AsertoError
- func (e *AsertoError) Time(key string, value time.Time) *AsertoError
- func (e *AsertoError) Unwrap() error
- func (e *AsertoError) WithGRPCStatus(grpcCode codes.Code) *AsertoError
- func (e *AsertoError) WithHTTPStatus(httpStatus int) *AsertoError
- type ContextError
Constants ¶
View Source
const (
HTTPStatusErrorMetadata = "aserto-http-statuscode"
)
View Source
const (
MessageKey = "msg"
)
Variables ¶
View Source
var (
ErrUnknown = NewAsertoError("E00000", codes.Internal, http.StatusInternalServerError, "an unknown error has occurred")
)
Functions ¶
func CustomErrorHandler ¶
Types ¶
type AsertoError ¶
type AsertoError struct { Code string StatusCode codes.Code Message string HTTPCode int // contains filtered or unexported fields }
AsertoError represents a well known error coming from an Aserto service.
func CodeToAsertoError ¶
func CodeToAsertoError(code string) *AsertoError
func FromGRPCStatus ¶
func FromGRPCStatus(grpcStatus status.Status) *AsertoError
Returns an Aserto error based on a given grpcStatus. The details that are not of type errdetails.ErrorInfo are dropped. and if there are details from multiple errors, the aserto error will be constructed based on the first one.
func NewAsertoError ¶
func UnwrapAsertoError ¶
func UnwrapAsertoError(err error) *AsertoError
func (*AsertoError) Bool ¶
func (e *AsertoError) Bool(key string, value bool) *AsertoError
func (*AsertoError) Cause ¶
func (e *AsertoError) Cause() error
func (*AsertoError) Copy ¶
func (e *AsertoError) Copy() *AsertoError
func (*AsertoError) Data ¶
func (e *AsertoError) Data() map[string]string
func (*AsertoError) Duration ¶
func (e *AsertoError) Duration(key string, value time.Duration) *AsertoError
func (*AsertoError) Err ¶
func (e *AsertoError) Err(err error) *AsertoError
Associates err with the AsertoError.
func (*AsertoError) Error ¶
func (e *AsertoError) Error() string
func (*AsertoError) Fields ¶
func (e *AsertoError) Fields() map[string]interface{}
func (*AsertoError) FromReader ¶
func (e *AsertoError) FromReader(key string, value io.Reader) *AsertoError
func (*AsertoError) GRPCStatus ¶
func (e *AsertoError) GRPCStatus() *status.Status
func (*AsertoError) Int ¶
func (e *AsertoError) Int(key string, value int) *AsertoError
func (*AsertoError) Int32 ¶
func (e *AsertoError) Int32(key string, value int32) *AsertoError
func (*AsertoError) Int64 ¶
func (e *AsertoError) Int64(key string, value int64) *AsertoError
func (*AsertoError) Interface ¶
func (e *AsertoError) Interface(key string, value interface{}) *AsertoError
func (*AsertoError) MarshalZerologObject ¶
func (e *AsertoError) MarshalZerologObject(event *zerolog.Event)
func (*AsertoError) Msg ¶
func (e *AsertoError) Msg(message string) *AsertoError
func (*AsertoError) Msgf ¶
func (e *AsertoError) Msgf(message string, args ...interface{}) *AsertoError
func (*AsertoError) SameAs ¶
func (e *AsertoError) SameAs(err error) bool
SameAs returns true if the provided error is an AsertoError and has the same error code.
func (*AsertoError) Str ¶
func (e *AsertoError) Str(key, value string) *AsertoError
func (*AsertoError) Time ¶
func (e *AsertoError) Time(key string, value time.Time) *AsertoError
func (*AsertoError) Unwrap ¶
func (e *AsertoError) Unwrap() error
func (*AsertoError) WithGRPCStatus ¶
func (e *AsertoError) WithGRPCStatus(grpcCode codes.Code) *AsertoError
func (*AsertoError) WithHTTPStatus ¶
func (e *AsertoError) WithHTTPStatus(httpStatus int) *AsertoError
type ContextError ¶ added in v0.0.8
ContextError represents a standard error that can also encapsulate a context.
func WithContext ¶ added in v0.0.8
func WithContext(err error, ctx context.Context) *ContextError
func WrapContext ¶ added in v0.0.8
func WrapContext(err error, ctx context.Context, message string) *ContextError
func WrapfContext ¶ added in v0.0.8
func WrapfContext(err error, ctx context.Context, format string, args ...interface{}) *ContextError
func (*ContextError) Cause ¶ added in v0.0.8
func (ce *ContextError) Cause() error
func (*ContextError) Error ¶ added in v0.0.8
func (ce *ContextError) Error() string
func (*ContextError) Unwrap ¶ added in v0.0.8
func (ce *ContextError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.