errors

package
v1.0.1 Latest Latest
Warning

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

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

Documentation

Overview

This package is a central repository of all compile errors that can be reported. It contains ways to collect and format errors to make it easy to find and correct workflow spec problems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetConfig

func SetConfig(cfg Config)

Sets global config.

func SetIncludeSource

func SetIncludeSource()

Types

type CompileError

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

Represents a compile error for coreWorkflow.

func NewAmbiguousBindingUnionValue

func NewAmbiguousBindingUnionValue(nodeID, sinkParam, expectedType, binding, match1, match2 string) *CompileError

func NewBranchNodeHasNoCondition

func NewBranchNodeHasNoCondition(branchNodeID string) *CompileError

func NewBranchNodeHasNoDefault

func NewBranchNodeHasNoDefault(branchNodeID string) *CompileError

func NewBranchNodeNotSpecified

func NewBranchNodeNotSpecified(branchNodeID string) *CompileError

func NewCycleDetectedInWorkflowErr

func NewCycleDetectedInWorkflowErr(nodeID, cycle string) *CompileError

func NewDuplicateAliasErr

func NewDuplicateAliasErr(nodeID, alias string) *CompileError

func NewDuplicateIDFoundErr

func NewDuplicateIDFoundErr(nodeID string) *CompileError

func NewFieldNotFoundErr

func NewFieldNotFoundErr(nodeID, fromVar, fromType, key string) *CompileError

func NewIllegalEnumValueError

func NewIllegalEnumValueError(nodeID, sinkParam, receivedVal string, expectedVals []string) *CompileError

func NewIncompatibleBindingUnionValue

func NewIncompatibleBindingUnionValue(nodeID, sinkParam, expectedType, binding string) *CompileError

func NewInconsistentTypesErr

func NewInconsistentTypesErr(nodeID, expectedType, actualType string) *CompileError

func NewInvalidValueErr

func NewInvalidValueErr(nodeID, paramName string) *CompileError

func NewMismatchingBindingsErr

func NewMismatchingBindingsErr(nodeID, sinkParam, expectedType, receivedType string) *CompileError

func NewMismatchingInterfacesErr

func NewMismatchingInterfacesErr(nodeID1, nodeID2 string) *CompileError

func NewMismatchingTypesErr

func NewMismatchingTypesErr(nodeID, fromVar, fromType, toType string) *CompileError

func NewNoConditionFound

func NewNoConditionFound(nodeID string) *CompileError

func NewNoNodesFoundErr

func NewNoNodesFoundErr(graphID string) *CompileError

func NewNodeReferenceNotFoundErr

func NewNodeReferenceNotFoundErr(nodeID, referenceID string) *CompileError

func NewParameterBoundMoreThanOnceErr

func NewParameterBoundMoreThanOnceErr(nodeID, paramName string) *CompileError

func NewParameterNotBoundErr

func NewParameterNotBoundErr(nodeID, paramName string) *CompileError

func NewSyntaxError

func NewSyntaxError(nodeID string, element string, err error) *CompileError

func NewTaskReferenceNotFoundErr

func NewTaskReferenceNotFoundErr(nodeID, referenceID string) *CompileError

func NewUnreachableNodesErr

func NewUnreachableNodesErr(nodeID, nodes string) *CompileError

func NewUnrecognizedValueErr

func NewUnrecognizedValueErr(nodeID, value string) *CompileError

func NewValueCollisionError

func NewValueCollisionError(nodeID string, valueName, value string) *CompileError

func NewValueRequiredErr

func NewValueRequiredErr(nodeID, paramName string) *CompileError

func NewVariableNameNotFoundErr

func NewVariableNameNotFoundErr(nodeID, referenceID, variableName string) *CompileError

func NewWorkflowBuildError

func NewWorkflowBuildError(err error) *CompileError

func NewWorkflowHasNoEntryNodeErr

func NewWorkflowHasNoEntryNodeErr(graphID string) *CompileError

func NewWorkflowReferenceNotFoundErr

func NewWorkflowReferenceNotFoundErr(nodeID, referenceID string) *CompileError

func (CompileError) Code

func (err CompileError) Code() ErrorCode

Gets the Compile Error code

func (CompileError) Error

func (err CompileError) Error() string

Gets a readable/formatted string explaining the compile error as well as at which node it occurred.

type CompileErrorWithCause

type CompileErrorWithCause struct {
	*CompileError
	// contains filtered or unexported fields
}

Represents a compile error with a root cause.

func (CompileErrorWithCause) Error

func (err CompileErrorWithCause) Error() string

Gets a readable/formatted string explaining the compile error as well as at which node it occurred.

type CompileErrors

type CompileErrors interface {
	error
	Collect(e ...*CompileError)
	NewScope() CompileErrors
	Errors() *compileErrorSet
	HasErrors() bool
	ErrorCount() int
}

A set of Compile errors.

func NewCompileErrors

func NewCompileErrors() CompileErrors

Creates a new empty compile errors

type Config

type Config struct {
	// Indicates that a panic should be issued as soon as the first error is collected.
	PanicOnError bool

	// Indicates that errors should include source code information when collected. There is an associated performance
	// penalty with this behavior.
	IncludeSource bool
}

Represents error config that can change the behavior of how errors collection/reporting is handled.

func GetConfig

func GetConfig() Config

Gets global config.

type ErrorCode

type ErrorCode string
const (
	// A cycle is detected in the Workflow, the error description should detail the nodes involved.
	CycleDetected ErrorCode = "CycleDetected"

	// BranchNode is missing a case with ThenNode populated.
	BranchNodeIDNotFound ErrorCode = "BranchNodeIdNotFound"

	// BranchNode is missing a condition.
	BranchNodeHasNoCondition ErrorCode = "BranchNodeHasNoCondition"

	// BranchNode is missing the else case & the else fail
	BranchNodeHasNoDefault ErrorCode = "BranchNodeHasNoDefault"

	// An expected field isn't populated.
	ValueRequired ErrorCode = "ValueRequired"

	// An expected field is malformed or contains invalid inputs
	InvalidValue ErrorCode = "InvalidValue"

	// A nodeBuilder referenced by an edge doesn't belong to the Workflow.
	NodeReferenceNotFound ErrorCode = "NodeReferenceNotFound"

	// A Task referenced by a node wasn't found.
	TaskReferenceNotFound ErrorCode = "TaskReferenceNotFound"

	// A Workflow referenced by a node wasn't found.
	WorkflowReferenceNotFound ErrorCode = "WorkflowReferenceNotFound"

	// A referenced variable (in a parameter or a condition) wasn't found.
	VariableNameNotFound ErrorCode = "VariableNameNotFound"

	// An alias existed twice.
	DuplicateAlias ErrorCode = "DuplicateAlias"

	// An Id existed twice.
	DuplicateNodeID ErrorCode = "DuplicateId"

	// Two types expected to be compatible but aren't.
	MismatchingTypes ErrorCode = "MismatchingTypes"

	// A binding is attempted via a list or map syntax, but the underlying type isn't a list or map.
	MismatchingBindings ErrorCode = "MismatchingBindings"

	// Two interfaced expected to be compatible but aren't.
	MismatchingInterfaces ErrorCode = "MismatchingInterfaces"

	// Expected types to be consistent.
	InconsistentTypes ErrorCode = "InconsistentTypes"

	// An input/output parameter was assigned a value through an edge more than once.
	ParameterBoundMoreThanOnce ErrorCode = "ParameterBoundMoreThanOnce"

	// One of the required input parameters or a Workflow output parameter wasn't bound.
	ParameterNotBound ErrorCode = "ParameterNotBound"

	// When we couldn't assign an entry point to the Workflow.
	NoEntryNodeFound ErrorCode = "NoEntryNodeFound"

	// When one more more unreachable node are detected.
	UnreachableNodes ErrorCode = "UnreachableNodes"

	// A Value doesn't fall within the expected range.
	UnrecognizedValue ErrorCode = "UnrecognizedValue"

	// An unknown error occurred while building the workflow.
	WorkflowBuildError ErrorCode = "WorkflowBuildError"

	// A value is expected to be unique but wasn't.
	ValueCollision ErrorCode = "ValueCollision"

	// A value isn't on the right syntax.
	SyntaxError ErrorCode = "SyntaxError"

	// A workflow is missing any nodes to execute
	NoNodesFound ErrorCode = "NoNodesFound"

	// Given value is not a legal Enum value (or not part of the defined set of enum values)
	IllegalEnumValue ErrorCode = "IllegalEnumValue"

	// Given value cannot be unambiguously assigned to a union variant in a binding
	AmbiguousBindingUnionValue ErrorCode = "AmbiguousBindingUnionValue"

	// Given value cannot be assigned to any union variant in a binding
	IncompatibleBindingUnionValue ErrorCode = "IncompatibleBindingUnionValue"

	// A gate node is missing a condition.
	NoConditionFound ErrorCode = "NoConditionFound"

	// Field not found in the dataclass
	FieldNotFoundError ErrorCode = "FieldNotFound"
)

Jump to

Keyboard shortcuts

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