Documentation
¶
Overview ¶
Package errors defines orchestration errors. This is following the patterns from https://blog.golang.org/go1.13-errors Error messages should contain a unique code easily parsable from string representation. Error IDs are 4 digit prefixed by "OE" (for Orchestration Error). Each error kind has 100 numbers reserved, here are the assigned ranges: - generic errors: 0-99 - asset related errors: 100-199
Index ¶
- Variables
- type ErrorKind
- type OrcError
- func FromValidationError(resource string, err error) *OrcError
- func NewBadRequest(msg string) *OrcError
- func NewCannotDisableAsset(msg string) *OrcError
- func NewCannotDisableModel(msg string) *OrcError
- func NewConflict(resource, key string) *OrcError
- func NewError(kind ErrorKind, msg string) *OrcError
- func NewIncompatibleTaskOutput(taskKey, identifier, expected, actual string) *OrcError
- func NewInternal(msg string) *OrcError
- func NewInvalidAsset(msg string) *OrcError
- func NewMissingTaskOutput(taskKey, identifier string) *OrcError
- func NewNotFound(resource, key string) *OrcError
- func NewPermissionDenied(msg string) *OrcError
- func NewTerminatedComputePlan(planKey string) *OrcError
- func NewTerminatedComputeTask(taskKey string) *OrcError
- func NewUnimplemented(msg string) *OrcError
Constants ¶
This section is empty.
Variables ¶
var ( // ErrByteArray happens when attempting to load invalid data as json byte array ErrByteArray = "OE0001" // ErrNotFound happens when the asset is not present in the persistence layer ErrNotFound = "OE0002" // ErrBadRequest happens when the request can't be fulfilled ErrBadRequest = "OE0003" // ErrConflict is a sentinel value to mark conflicting asset errors. ErrConflict = "OE0006" // value 6 match gRPC AlreadyExists status code // ErrInternal happens when an unexpected error occurs (eg; unreachable code) ErrInternal = "OE0007" // ErrUnimplemented occurs when unimplemented code is triggered ErrUnimplemented = "OE0010" // ErrInvalidAsset marks asset validation errors ErrInvalidAsset = "OE0101" // ErrPermissionDenied happens when you try to perform an action on an asset // that you do not own. ErrPermissionDenied = "OE0102" // ErrIncompatibleTaskStatus occurs when a task cannot be processed due to its status ErrIncompatibleTaskStatus = "OE0104" // ErrCannotDisableModel occurs when attempting to disable a model that is not eligible ErrCannotDisableModel = "OE0105" // ErrMissingTaskOutput occurs when attempting to register an asset referencing a non-existing task output ErrMissingTaskOutput = "OE0106" // ErrIncompatibleKind occurs when attempting to register an asset for a task output of a different kind ErrIncompatibleKind = "OE0107" // ErrCannotDisableOutput occurs when attempting to disable an output that is not eligible ErrCannotDisableOutput = "OE0108" // ErrTerminatedComputePlan occurs when attempting to cancel or fail an already terminated compute plan ErrTerminatedComputePlan = "OE0109" // ErrTerminatedComputeTask occurs when attempting to cancel or fail an already terminated compute plan ErrTerminatedComputeTask = "OE0110" )
Functions ¶
This section is empty.
Types ¶
type ErrorKind ¶
type ErrorKind = string
ErrorKind is unique per kind of orchestration error. It may be used to determine response status.
type OrcError ¶
type OrcError struct { Kind ErrorKind // contains filtered or unexported fields }
OrcError represents an orchestration error. It may wrap another error and will always contain a specific error code.
func FromValidationError ¶
FromValidationError returns an OrcError with ErrInvalidAsset kind wrapping the underlying validation error
func NewBadRequest ¶
NewBadRequest returns an ErrBadRequest kind of OrcError with given message
func NewCannotDisableAsset ¶
NewCannotDisableAsset returns an ErrCannotDisableModel kind of OrcError with given message
func NewCannotDisableModel ¶
NewCannotDisableModel returns an ErrCannotDisableModel kind of OrcError with given message
func NewConflict ¶
NewConflict returns an ErrConflict kind of OrcError with relevant message
func NewInternal ¶
NewInternal returns an ErrInternalError kind of OrcError with given message
func NewInvalidAsset ¶
NewInvalidAsset returns an ErrInvalidAsset kind of OrcError with given message
func NewMissingTaskOutput ¶
func NewNotFound ¶
NewNotFound returns an ErrNotFound kind of OrcError with relevant message
func NewPermissionDenied ¶
NewPermissionDenied returns an ErrPermissionDenied kind of OrcError with given message
func NewTerminatedComputePlan ¶
NewTerminatedComputePlan returns an ErrTerminatedComputePlan kind of OrcError with given message
func NewTerminatedComputeTask ¶
NewTerminatedComputeTask returns an ErrTerminatedComputeTask kind of OrcError with given message
func NewUnimplemented ¶
NewUnimplemented returns an ErrUnimplemented kind of OrcError with given message