errors

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2019 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 NewBranchNodeHasNoCondition

func NewBranchNodeHasNoCondition(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 NewInconsistentTypesErr

func NewInconsistentTypesErr(nodeID, expectedType, actualType 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 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"

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

	// 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 wasnt.
	ValueCollision ErrorCode = "ValueCollision"

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

Jump to

Keyboard shortcuts

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