errorhandling

package
v0.396.6 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorUpperCamel                          = "E001"
	ErrorActionNameLowerCamel                = "E002"
	ErrorFieldNamesUniqueInModel             = "E003"
	ErrorActionUniqueGlobally                = "E004"
	ErrorInvalidActionInput                  = "E005"
	ErrorReservedFieldName                   = "E006"
	ErrorUnsupportedFieldType                = "E009"
	ErrorUniqueModelsGlobally                = "E010"
	ErrorUnsupportedAttributeType            = "E011"
	ErrorFieldNameLowerCamel                 = "E012"
	ErrorInvalidAttributeArgument            = "E013"
	ErrorAttributeRequiresNamedArguments     = "E014"
	ErrorAttributeMissingRequiredArgument    = "E015"
	ErrorInvalidValue                        = "E016"
	ErrorUniqueAPIGlobally                   = "E017"
	ErrorUniqueRoleGlobally                  = "E018"
	ErrorUniqueEnumGlobally                  = "E019"
	ErrorUnresolvableExpression              = "E020"
	ErrorForbiddenExpressionAction           = "E022"
	ErrorIncorrectArguments                  = "E024"
	ErrorInvalidSyntax                       = "E025"
	ErrorExpressionTypeMismatch              = "E026"
	ErrorForbiddenOperator                   = "E027"
	ErrorNonBooleanValueCondition            = "E028"
	ErrorExpressionArrayMismatchingOperator  = "E030"
	ErrorExpressionMixedTypesInArrayLiteral  = "E032"
	ErrorCreateActionNoInputs                = "E033"
	ErrorCreateActionMissingInput            = "E034"
	ErrorNonDirectComparisonOperatorUsed     = "E037"
	ErrorUnusedInput                         = "E038"
	ErrorInvalidOneToOneRelationship         = "E039"
	ErrorInvalidActionType                   = "E040"
	ErrorModelNotAllowedAsInput              = "E041"
	ErrorClashingImplicitInput               = "E043"
	ErrorMissingRelationshipField            = "E044"
	ErrorAmbiguousRelationship               = "E045"
	ErrorModelNotFound                       = "E047"
	ErrorExpressionFieldTypeMismatch         = "E048"
	ErrorExpressionMultipleConditions        = "E049"
	ErrorDefaultExpressionNeeded             = "E050"
	ErrorDefaultExpressionOperatorPresent    = "E051"
	ErrorFieldNamesMaxLength                 = "E052"
	ErrorModelNamesMaxLength                 = "E053"
	ErrorCreateActionAmbiguousRelationship   = "E059"
	ErrorExpressionTypeNotNullable           = "E060"
	ErrorExpressionSingleConditionNotBoolean = "E061"
)

error codes

Variables

This section is empty.

Functions

This section is empty.

Types

type CorrectionHint

type CorrectionHint struct {
	Hint
	Query   string
	Results []string
}

func NewCorrectionHint

func NewCorrectionHint(referenceCollection []string, query string) *CorrectionHint

func (*CorrectionHint) ToString

func (hint *CorrectionHint) ToString() string

type ErrorDetails

type ErrorDetails struct {
	Message string `json:"message" yaml:"message"`
	Hint    string `json:"hint" yaml:"hint"`
}

type ErrorType

type ErrorType string
const (
	NamingError              ErrorType = "NamingError"
	DuplicateDefinitionError ErrorType = "DuplicateDefinitionError"
	TypeError                ErrorType = "TypeError"
	UndefinedError           ErrorType = "UndefinedError"
	ActionInputError         ErrorType = "ActionInputError"
	AttributeArgumentError   ErrorType = "AttributeArgumentError"
	AttributeNotAllowedError ErrorType = "AttributeNotAllowedError"
	RelationshipError        ErrorType = "RelationshipError"
	JobDefinitionError       ErrorType = "JobDefinitionError"
	UnsupportedFeatureError  ErrorType = "UnsupportedFeatureError"
)

type Hint

type Hint interface {
	ToString() string
}

type LexerPos

type LexerPos struct {
	Filename string `json:"filename"`
	Offset   int    `json:"offset"`
	Line     int    `json:"line"`
	Column   int    `json:"column"`
}

type NormalHint

type NormalHint struct {
	Hint
	Message string
}

func NewHint

func NewHint(message string) *NormalHint

func (*NormalHint) ToString

func (hint *NormalHint) ToString() string

type TemplateLiterals

type TemplateLiterals struct {
	Literals map[string]string
}

type ValidationError

type ValidationError struct {
	*ErrorDetails

	Code   string   `json:"code" regexp:"\\d+"`
	Pos    LexerPos `json:"pos,omitempty"`
	EndPos LexerPos `json:"endPos,omitempty"`
}

func NewValidationError

func NewValidationError(code string, data TemplateLiterals, position node.ParserNode) *ValidationError

func NewValidationErrorWithDetails

func NewValidationErrorWithDetails(t ErrorType, details ErrorDetails, position node.ParserNode) *ValidationError

func (ValidationError) Error

func (e ValidationError) Error() string

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

type ValidationErrors

type ValidationErrors struct {
	Errors   []*ValidationError `json:"errors"`
	Warnings []*ValidationError `json:"warnings"`
}

func (*ValidationErrors) Append

func (v *ValidationErrors) Append(code string, data map[string]string, node node.ParserNode)

func (*ValidationErrors) AppendError

func (v *ValidationErrors) AppendError(e *ValidationError)

func (*ValidationErrors) AppendWarning added in v0.386.1

func (v *ValidationErrors) AppendWarning(e *ValidationError)

func (*ValidationErrors) Concat

func (v *ValidationErrors) Concat(verrs ValidationErrors)

func (ValidationErrors) Error

func (v ValidationErrors) Error() string

func (*ValidationErrors) ErrorsToAnnotatedSchema added in v0.386.1

func (verrs *ValidationErrors) ErrorsToAnnotatedSchema(sources []*reader.SchemaFile) string

ErrorsToAnnotatedSchema formats the validation errors by pointing to the relevant line in the source file that produced the error

The output is formatted using ANSI colours (if supported by the environment).

func (ValidationErrors) HasErrors added in v0.386.1

func (v ValidationErrors) HasErrors() bool

func (ValidationErrors) HasWarnings added in v0.386.1

func (v ValidationErrors) HasWarnings() bool

func (*ValidationErrors) ToAnnotatedSchema

func (verrs *ValidationErrors) ToAnnotatedSchema(sources []*reader.SchemaFile) string

ToAnnotatedSchema formats both the validation errors and warnings by pointing to the relevant line in the source file that produced the error

The output is formatted using ANSI colours (if supported by the environment).

func (ValidationErrors) Warning added in v0.386.1

func (v ValidationErrors) Warning() string

func (*ValidationErrors) WarningsToAnnotatedSchema added in v0.386.1

func (verrs *ValidationErrors) WarningsToAnnotatedSchema(sources []*reader.SchemaFile) string

WarningsToAnnotatedSchema formats the validation warnings by pointing to the relevant line in the source file that produced the error

The output is formatted using ANSI colours (if supported by the environment).

Jump to

Keyboard shortcuts

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