errors

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HttpErrorHandle

func HttpErrorHandle(err error, response *http.Response) error

Types

type ErrorCode

type ErrorCode string
const (
	UnexpectedError          ErrorCode = "UnexpectedError"
	NotFound                 ErrorCode = "NotFound"
	Conflict                 ErrorCode = "Conflict"
	PaginationError          ErrorCode = "PaginationError"
	TeapotError              ErrorCode = "TeapotError"
	ContextError             ErrorCode = "ContextError"
	DuplicateEntity          ErrorCode = "DuplicateEntity"
	ConnectionError          ErrorCode = "ConnectionError"
	UnprocessableEntityError ErrorCode = "UnprocessableEntityError"
	EmptyDecisionLogs        ErrorCode = "EmptyDecisionLogs"
	MissingRequestAttribute  ErrorCode = "MissingRequestAttribute"
	ForbiddenAccess          ErrorCode = "ForbiddenAccess"
	Unauthorized             ErrorCode = "Unauthorized"
	InvalidPermissionFormat  ErrorCode = "InvalidPermissionFormat"
	MissingPermissions       ErrorCode = "MissingPermissions"
	UnsupportedAttributeType ErrorCode = "UnsupportedAttributeType"
	MissingResourceAttribute ErrorCode = "MissingResourceAttribute"
	InvalidPolicyRepoStatus  ErrorCode = "InvalidPolicyRepoStatus"
	MismatchAttributesTypes  ErrorCode = "MismatchAttributesTypes"
)

type ErrorMessage

type ErrorMessage string
const (
	EmptyErrorMessage          ErrorMessage = ""
	PaginationMessage          ErrorMessage = "The pagination page and size per page are invalid"
	ConflictMessage            ErrorMessage = "The resource already exists"
	NotFoundMessage            ErrorMessage = "The resource was not found"
	UnexpectedErrorMessage     ErrorMessage = "An unexpected error happened."
	ForbiddenMessage           ErrorMessage = "The access for this object is forbidden using the provided API key"
	ContextMessage             ErrorMessage = "The context is missing or invalid"
	ContextUnexpectedMessage   ErrorMessage = "The context is missing or invalid"
	UnauthorizedMessage        ErrorMessage = "" /* 136-byte string literal not displayed */
	DuplicateEntityMessage     ErrorMessage = "The entity already exists"
	ConnectionErrorMessage     ErrorMessage = "The connection to the api failed"
	UnprocessableEntityMessage ErrorMessage = "The entity send with the request is not valid"
)

type ErrorType

type ErrorType string
const (
	GENERAL_ERROR         ErrorType = "general_error"
	API_ERROR             ErrorType = "api_error"
	CACHE_ERROR           ErrorType = "cache_error"
	INVALID_REQUEST_ERROR ErrorType = "invalid_request_error"
)

type PermitError

type PermitError struct {
	StatusCode   int
	ResponseBody string
	ErrorCode    ErrorCode
	ErrorType    ErrorType
	// contains filtered or unexported fields
}

func NewPermitConflictError

func NewPermitConflictError(response *http.Response) PermitError

func NewPermitConnectionError

func NewPermitConnectionError(err error) PermitError

func NewPermitContextError

func NewPermitContextError(additionalMessage ErrorMessage) PermitError

func NewPermitDuplicateEntityError

func NewPermitDuplicateEntityError(err error, response *http.Response) PermitError

func NewPermitError

func NewPermitError(errorMessage ErrorMessage, errorCode ErrorCode, errorType ErrorType, response *http.Response) PermitError

func NewPermitForbiddenError

func NewPermitForbiddenError(response *http.Response) PermitError

func NewPermitNotFoundError

func NewPermitNotFoundError(err error, response *http.Response) PermitError

func NewPermitPaginationError

func NewPermitPaginationError() PermitError

func NewPermitUnauthorizedError

func NewPermitUnauthorizedError(response *http.Response) PermitError

func NewPermitUnexpectedError

func NewPermitUnexpectedError(err error, response *http.Response) PermitError

func NewPermitUnprocessableEntityError

func NewPermitUnprocessableEntityError(err error, response *http.Response) PermitError

Jump to

Keyboard shortcuts

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