Documentation
¶
Overview ¶
Package errorstack exposes a set of error handling utilities for consistency across the Temporal Land ecosystem. Every packages leverage this one for error handling.
This package must not import any other package of this ecosystem.
Index ¶
- func ActivityNotConfigured(activity string) error
- func InputNotValid(activity string, validations []Validation) error
- func IntegrationNotReady() error
- func NewApplicationError(message string, errType string, cause error) error
- func NewNonRetryableApplicationError(message string, errType string, cause error) error
- func WorkflowNotConfigured(workflow string) error
- type Error
- type Validation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActivityNotConfigured ¶
ActivityNotConfigured is a shortcut to return NewNonRetryableApplicationError with the appropriate error message when an activity is not properly configured to be used by an integration.
func InputNotValid ¶
func InputNotValid(activity string, validations []Validation) error
InputNotValid is a shortcut to return NewNonRetryableApplicationError with the appropriate error message when a workflow or activity input is not valid.
func IntegrationNotReady ¶
func IntegrationNotReady() error
IntegrationNotReady is a shortcut to return NewNonRetryableApplicationError with the appropriate error message when an integration is not ready to be used.
func NewApplicationError ¶
NewApplicationError is a wrapper to handle Temporal retryable errors consistently in the ecosystem.
func NewNonRetryableApplicationError ¶
NewNonRetryableApplicationError is a wrapper to handle Temporal non-retryable errors consistently in the ecosystem.
func WorkflowNotConfigured ¶
WorkflowNotConfigured is a shortcut to return NewNonRetryableApplicationError with the appropriate error message when a workflow is not properly configured to be used by an integration.
Types ¶
type Error ¶
type Error struct {
// Integration is the name of the integration defined by the end-user returning
// the error.
//
// Example: "warehouse"
Integration string `json:"integration,omitempty"`
// Specification is the name of the specification (if applicable) returning the
// error.
//
// Example: "sqlike"
Specification string `json:"specification,omitempty"`
// Message is the top-level message of the error.
Message string `json:"message"`
// Validations represents a list of failed input validations. This is mostly
// used when a specification or integration's Config encountered bad inputs
// set by end-users.
Validations []Validation `json:"validations,omitempty"`
// Children holds child errors encountered in cascade related to the current
// error.
Children []error `json:"children,omitempty"`
}
Error implements the Go native error type. It is designed to handle errors from outside of Temporal workflows and activities.
func New ¶
New returns a new error for the given integration, specification, and top-level error message.
func (*Error) Error ¶
Error returns the stringified version of the error, including its validation failures and children errors. Since Error is designed for errors outside of Temporal workflows and activities, this string is designed for CLIs and humans.
func (*Error) HasChildren ¶
HasChildren indicates if an error caused other (a.k.a. children) errors.
func (*Error) HasValidations ¶
HasValidations indicates if an error encountered validation failures.
func (*Error) WithChildren ¶
WithChildren adds a list of child errors encountered related to the current error.
func (*Error) WithValidations ¶
func (err *Error) WithValidations(validations ...Validation) error
WithValidations adds validation failures to an error.
type Validation ¶
type Validation struct {
// Message is the cause of the validation failure.
Message string `json:"message"`
// Path represents the path to the key where the validation failure occurred.
//
// Example: []string{"Config", "APIKey"}
Path []string `json:"path,omitempty"`
}
Validation holds some details about an input validation failure.