resterr

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPErrorHandler

func HTTPErrorHandler(tracer trace.Tracer) func(err error, c echo.Context)

Types

type CustomError

type CustomError struct {
	Code            ErrorCode
	IncorrectValue  string
	FailedOperation string
	Component       string
	Err             error
}

func NewCustomError

func NewCustomError(code ErrorCode, err error) *CustomError

func NewOIDCError

func NewOIDCError(message string, raw error) *CustomError

func NewSystemError

func NewSystemError(component, failedOperation string, err error) *CustomError

func NewUnauthorizedError

func NewUnauthorizedError(err error) *CustomError

func NewValidationError

func NewValidationError(code ErrorCode, incorrectValue string, err error) *CustomError

func (*CustomError) Error

func (e *CustomError) Error() string

func (*CustomError) HTTPCodeMsg

func (e *CustomError) HTTPCodeMsg() (int, interface{})

type ErrorCode

type ErrorCode string
const (
	SystemError                      ErrorCode = "system-error"
	Unauthorized                     ErrorCode = "unauthorized"
	InvalidValue                     ErrorCode = "invalid-value"
	AlreadyExist                     ErrorCode = "already-exist"
	DoesntExist                      ErrorCode = "doesnt-exist"
	ConditionNotMet                  ErrorCode = "condition-not-met"
	OIDCError                        ErrorCode = "oidc-error"
	OIDCTxNotFound                   ErrorCode = "oidc-tx-not-found"
	OIDCPreAuthorizeDoesNotExpectPin ErrorCode = "oidc-pre-authorize-does-not-expect-pin"
	OIDCPreAuthorizeExpectPin        ErrorCode = "oidc-pre-authorize-expect-pin"
	OIDCPreAuthorizeInvalidPin       ErrorCode = "oidc-pre-authorize-invalid-pin"
	OIDCPreAuthorizeInvalidClientID  ErrorCode = "oidc-pre-authorize-invalid-client-id"
	OIDCCredentialFormatNotSupported ErrorCode = "oidc-credential-format-not-supported" //nolint:gosec
	OIDCCredentialTypeNotSupported   ErrorCode = "oidc-credential-type-not-supported"   //nolint:gosec
	InvalidOrMissingProofOIDCErr     ErrorCode = "invalid_or_missing_proof"
)

func (ErrorCode) Name

func (c ErrorCode) Name() string

type FositeError

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

func NewFositeError

func NewFositeError(code FositeErrorCode, ctx echo.Context, w fositeErrorWriter, err error) *FositeError

func (*FositeError) Error

func (e *FositeError) Error() string

func (*FositeError) WithAccessRequester

func (e *FositeError) WithAccessRequester(requester fosite.AccessRequester) *FositeError

func (*FositeError) WithAuthorizeRequester

func (e *FositeError) WithAuthorizeRequester(requester fosite.AuthorizeRequester) *FositeError

func (*FositeError) Write

func (e *FositeError) Write() error

type FositeErrorCode

type FositeErrorCode int
const (
	FositeAuthorizeError FositeErrorCode = iota
	FositeAccessError
	FositeIntrospectionError
	FositePARError
)

type RegistrationError added in v1.1.0

type RegistrationError struct {
	Code string
	Err  error
}

RegistrationError is used to indicate a validation error during dynamic client registration. When a registration error condition occurs, the authorization server returns an HTTP 400 status code with content type "application/json" consisting of a JSON object describing the error in the response body.

func (*RegistrationError) Error added in v1.1.0

func (e *RegistrationError) Error() string

Jump to

Keyboard shortcuts

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