perr

package
v1.5.7 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorCodeBadRequest        = "error_bad_request"
	ErrorCodeInvalidData       = "error_invalid_data"
	ErrorCodeDependencyFailure = "error_dependency_failure"
)
View Source
const (
	ErrorCodeExecutionError = "error_execution"
	StatusExecutionError    = 460
)
View Source
const (
	ErrorCodeInternal              = "error_internal"
	ErrorCodeInternalTokenTooLarge = "error_internal_token_too_large"
	ErrorCodeJsonSyntaxError       = "error_json_syntax_error"
)
View Source
const (
	ErrorCodeNotFound        = "error_not_found"
	ErrorCodeTriggerDisabled = "error_trigger_disabled"
)
View Source
const (
	ErrorCodeQuotaExceeded             = "error_quota_exceeded"
	ErrorCodeAssociationExists         = "association_exists"
	ErrorCodeWorkspaceMembershipExists = "workspace_membership_exists"
)
View Source
const (
	ErrorCodeUserDefined = "error_user_defined"
	StatusUserDefined    = 461
)
View Source
const (
	ErrorCodeConflict = "error_conflict"
)
View Source
const (
	ErrorCodeForbidden = "error_forbidden"
)
View Source
const (
	ErrorCodeMethodNotAllowed = "not_allowed"
)
View Source
const (
	ErrorCodePreconditionFailed = "error_precondition_failed"
)
View Source
const (
	ErrorCodeRequestTimeout = "error_request_timeout"
)
View Source
const (
	ErrorCodeServiceUnavailable = "error_service_unavailable"
)
View Source
const (
	ErrorCodeTooManyRequests = "error_too_many_requests"
)
View Source
const (
	ErrorCodeUnauthorized = "error_unauthorized"
)
View Source
const (
	ErrorCodeUnsupportedPlanValue = "error_unsupported_plan_value"
)

Variables

This section is empty.

Functions

func IsBadRequest

func IsBadRequest(err error) bool

func IsConflict

func IsConflict(err error) bool

func IsExecutionError

func IsExecutionError(err error) bool

func IsForbidden

func IsForbidden(err error) bool

func IsInternal

func IsInternal(err error) bool

func IsMethodNotAllowed

func IsMethodNotAllowed(err error) bool

func IsNotFound

func IsNotFound(err error) bool

func IsPerr

func IsPerr(err error) bool

func IsPreconditionFailed

func IsPreconditionFailed(err error) bool

func IsQuotaExceeded

func IsQuotaExceeded(err error) bool

func IsServiceUnavailable

func IsServiceUnavailable(err error) bool

func IsTimeout

func IsTimeout(err error) bool

func IsTooManyRequests

func IsTooManyRequests(err error) bool

func IsUnauthorized

func IsUnauthorized(err error) bool

func IsUserDefined

func IsUserDefined(err error) bool

Types

type ErrorDetailModel

type ErrorDetailModel struct {
	Message  string `json:"message"`
	Location string `json:"location,omitempty"`
}

As per RFC7807 (https://tools.ietf.org/html/rfc7807) define a standard error model with a limited set of Flowpipe-specific extensions Initial inspiration taken from https://github.com/danielgtaylor/huma/blob/master/error.go

type ErrorModel

type ErrorModel struct {
	Instance string `json:"instance" binding:"required"`
	ID       string `json:"-"`
	Type     string `json:"type" binding:"required"`
	Title    string `json:"title" binding:"required"`
	Status   int    `json:"status" binding:"required"`

	// If we don't have required it comes out as pointer and there is a bug in the formatter
	Detail string `json:"detail" binding:"required"`

	ValidationErrors []*ErrorDetailModel `json:"validation_errors,omitempty"`
}

func AssociationExist

func AssociationExist(item string, associations string) ErrorModel

func BadRequest

func BadRequest(itemType string, id string) ErrorModel

func BadRequestWithMessage

func BadRequestWithMessage(msg string) ErrorModel

func BadRequestWithTypeAndMessage

func BadRequestWithTypeAndMessage(errorType string, msg string) ErrorModel

func Conflict

func Conflict(itemType string, id string) ErrorModel

func ConflictWithMessage

func ConflictWithMessage(msg string) ErrorModel

func ExecutionError

func ExecutionError(itemType string, id string) ErrorModel

func ExecutionErrorWithMessage

func ExecutionErrorWithMessage(msg string) ErrorModel

func ExecutionErrorWithTypeAndMessage

func ExecutionErrorWithTypeAndMessage(errorType string, msg string) ErrorModel

func Forbidden

func Forbidden() ErrorModel

func ForbiddenWithMessage

func ForbiddenWithMessage(msg string) ErrorModel

func FromHttpError

func FromHttpError(err error, statusCode int) ErrorModel

func Internal

func Internal(err error) ErrorModel

func InternalWithMessage

func InternalWithMessage(msg string) ErrorModel

func InternalWithMessageAndType

func InternalWithMessageAndType(errorType string, msg string) ErrorModel

func MembershipExist

func MembershipExist(item string, associations string) ErrorModel

func MethodNotAllowed

func MethodNotAllowed() ErrorModel

func MethodNotAllowedWithMessage

func MethodNotAllowedWithMessage(msg string) ErrorModel

func NotFound

func NotFound(itemType string, id string) ErrorModel

func NotFoundWithMessage

func NotFoundWithMessage(msg string) ErrorModel

func NotFoundWithMessageAndType added in v0.2.0

func NotFoundWithMessageAndType(errorType string, msg string) ErrorModel

func PreconditionFailed

func PreconditionFailed(expected string) ErrorModel

func PreconditionFailedWithMessage

func PreconditionFailedWithMessage(msg string) ErrorModel

func QuotaExceeded

func QuotaExceeded(itemType string, max int) ErrorModel

func QuotaExceededWithMessage

func QuotaExceededWithMessage(msg string) ErrorModel

func ServiceUnavailable

func ServiceUnavailable() ErrorModel

func ServiceUnavailableWithMessage

func ServiceUnavailableWithMessage(msg string) ErrorModel

func Timeout

func Timeout(itemType string, id string) ErrorModel

func TimeoutWithMessage

func TimeoutWithMessage(msg string) ErrorModel

func TooManyRequests

func TooManyRequests(itemType string, id string) ErrorModel

func TooManyRequestsWithMessage

func TooManyRequestsWithMessage(msg string) ErrorModel

func TooManyRequestsWithTypeAndMessage

func TooManyRequestsWithTypeAndMessage(errorType string, msg string) ErrorModel

func Unauthorized

func Unauthorized() ErrorModel

func UnauthorizedWithMessage

func UnauthorizedWithMessage(msg string) ErrorModel

func UnsupportedPlanValue

func UnsupportedPlanValue(itemType, value string) ErrorModel

func UnsupportedPlanValueWithMessage

func UnsupportedPlanValueWithMessage(msg string) ErrorModel

func UserDefined

func UserDefined(itemType string, id string) ErrorModel

func UserDefinedWithMessage

func UserDefinedWithMessage(msg string) ErrorModel

func UserDefinedWithTypeAndMessage

func UserDefinedWithTypeAndMessage(errorType string, msg string) ErrorModel

func (ErrorModel) Error

func (e ErrorModel) Error() string

func (ErrorModel) GetStatus

func (e ErrorModel) GetStatus() int

type Frame

type Frame uintptr

Frame represents a program counter inside a stack frame. For historical reasons if Frame is interpreted as a uintptr its value represents the program counter + 1.

func (Frame) Format

func (f Frame) Format(s fmt.State, verb rune)

Format formats the frame according to the fmt.Formatter interface.

%s    source file
%d    source line
%n    function name
%v    equivalent to %s:%d

Format accepts flags that alter the printing of some verbs, as follows:

%+s   function name and path of source file relative to the compile time
      GOPATH separated by \n\t (<funcname>\n\t<path>)
%+v   equivalent to %+s:%d

func (Frame) MarshalText

func (f Frame) MarshalText() ([]byte, error)

MarshalText formats a stacktrace Frame as a text string. The output is the same as that of fmt.Sprintf("%+v", f), but without newlines or tabs.

type StackTrace

type StackTrace []Frame

StackTrace is stack of Frames from innermost (newest) to outermost (oldest).

func (StackTrace) Format

func (st StackTrace) Format(s fmt.State, verb rune)

Format formats the stack of Frames according to the fmt.Formatter interface.

%s	lists source files for each Frame in the stack
%v	lists the source file and line number for each Frame in the stack

Format accepts flags that alter the printing of some verbs, as follows:

%+v   Prints filename, function, and line number for each Frame in the stack.

type ValidationError

type ValidationError struct {
	Type   string                     `json:"type"`   // Denotes the location where the validation error was encountered.
	Errors validator.ValidationErrors `json:"errors"` // The list of validation errors.
}

func (ValidationError) Error

func (e ValidationError) Error() string

Jump to

Keyboard shortcuts

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