exception

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//abstract errors
	ErrAbstrForbidden           = generateAbstrErr("request forbidden", "not authorized")
	ErrAbstrUnknown             = generateAbstrErr("unknown", "unknown error")
	ErrAbstrInvalidArg          = generateAbstrErr("invalid", "invalid argument")
	ErrAbstrInvalidEndpoint     = generateAbstrErr("invalid", "invalid endpoint to parse")
	ErrAbstrServiceUnavailable  = generateAbstrErr("serviceUnvailable", "connection refused")
	ErrAbstrInternal            = generateAbstrErr("internal", "internal error")
	ErrAbstrAuthHeaderMissing   = generateAbstrErr("authHeaderMissing", "Authorization header is missing")
	ErrAbstrAuthHeaderMalformed = generateAbstrErr("authHeaderMalformed", "Authorization header is malformed")
	ErrAbstrInvalidObligations  = generateAbstrErr("internal", "invalid obligations")
)

Functions

This section is empty.

Types

type ErrOpt

type ErrOpt func(he *HttpError)

func WithCode

func WithCode(code string) ErrOpt

func WithError

func WithError(err error) ErrOpt

func WithHttpStatus

func WithHttpStatus(status int) ErrOpt

type HttpError

type HttpError struct {
	Status int
	// contains filtered or unexported fields
}

func AbstractError

func AbstractError(err *HttpError) *HttpError

AbstractError trims some privileged information from errors as these get sent directly as grpc responses

func GrpcToHttpError

func GrpcToHttpError(err error) *HttpError

HttpError translates opa errors to http status errors

func NewHttpError

func NewHttpError(opts ...ErrOpt) *HttpError

Jump to

Keyboard shortcuts

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