errors

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// core
	ErrMissingID              = errors.New("resource ID MUST be greater than zero")
	ErrDuplicatedID           = errors.New("IDs MUST be unique among all resources under same Model")
	ErrMissingResource        = errors.New("resource MUST be defined prior to referencing")
	ErrDuplicatedIndices      = errors.New("indices v1, v2 and v3 MUST be distinct")
	ErrIndexOutOfBounds       = errors.New("index is bigger than referenced slice")
	ErrInsufficientVertices   = errors.New("mesh MUST contain at least 3 vertices to form a solid body")
	ErrInsufficientTriangles  = errors.New("mesh MUST contain at least 4 triangles to form a solid body")
	ErrComponentsPID          = errors.New("MUST NOT assign pid to objects that contain components")
	ErrOPCPartName            = errors.New("part name MUST conform to the syntax specified in the OPC specification")
	ErrOPCRelTarget           = errors.New("relationship target part MUST be included in the 3MF document")
	ErrOPCDuplicatedRel       = errors.New("there MUST NOT be more than one relationship of a given type from one part to a second part")
	ErrOPCContentType         = errors.New("part MUST use an appropriate content type specified")
	ErrOPCDuplicatedTicket    = errors.New("each model part MUST attach no more than one PrintTicket")
	ErrOPCDuplicatedModelName = errors.New("model part names MUST be unique")
	ErrMetadataName           = errors.New("names without a namespace MUST be restricted to predefined values")
	ErrMetadataNamespace      = errors.New("namespace MUST be declared on the model")
	ErrMetadataDuplicated     = errors.New("names MUST NOT be duplicated")
	ErrOtherItem              = errors.New("MUST NOT reference objects of type other")
	ErrNonObject              = errors.New("MUST NOT reference non-object resources")
	ErrRequiredExt            = errors.New("unsupported required extension")
	ErrEmptyResourceProps     = errors.New("resource properties MUST NOT be empty")
	ErrRecursion              = errors.New("MUST NOT contain recursive references")
	ErrInvalidObject          = errors.New("MUST contain a mesh or components")
	ErrMeshConsistency        = errors.New("mesh has non-manifold edges without consistent triangle orientation")
)

Error guards.

Functions

func Append

func Append(err error, errs ...error) error

Append is a helper function that will append more errors onto an List in order to create a larger multi-error.

If err is not a errors.List, then it will be turned into one. If any of the errs are errors.List, they will be flattened one level into err.

func NewMissingFieldError

func NewMissingFieldError(name string) error

func Wrap

func Wrap(err error, name string) error

func WrapIndex

func WrapIndex(err error, name string, index int) error

func WrapPath

func WrapPath(err error, name string, path string) error

Types

type Error

type Error struct {
	Target []Level
	Err    error
	Path   string
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

func (*Error) XPath added in v0.24.0

func (e *Error) XPath() string

type Level

type Level struct {
	Name  string
	Index int // -1 if not needed
}

func (*Level) String

func (l *Level) String() string

type List

type List struct {
	Errors []error
}

List is an error type to track multiple errors. This is used to accumulate errors in cases and return them as a single "error".

func (*List) Error

func (e *List) Error() string

func (*List) Len

func (e *List) Len() int

func (*List) Less

func (e *List) Less(i, j int) bool

func (*List) Swap

func (e *List) Swap(i, j int)

func (*List) Unwrap

func (e *List) Unwrap() error

Unwrap returns the first error of the chain if not empty.

type MissingFieldError

type MissingFieldError struct {
	Name string
}

func (*MissingFieldError) Error

func (e *MissingFieldError) Error() string

type ParseAttrError

type ParseAttrError struct {
	Name     string
	Required bool
}

func NewParseAttrError

func NewParseAttrError(name string, required bool) *ParseAttrError

func (*ParseAttrError) Error

func (e *ParseAttrError) Error() string

Jump to

Keyboard shortcuts

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