merror

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Standard Errors
	ErrBadRequest    = errors.New("Bad Request")
	ErrUnauthorized  = errors.New("Unauthorized")
	ErrForbidden     = errors.New("Forbidden")
	ErrUserInactive  = errors.New("User Inactive")
	ErrNotFound      = errors.New("Not Found")
	ErrAlreadyExists = errors.New("Already Exists")
	ErrInternal      = errors.New("Internal Error")
)

Standard Errors

View Source
var (
	ErrMxCompileError    = errors.New("MX failed to compile")
	ErrReticulationError = errors.New("Reticulation Error")
	ErrCheckerError      = errors.New("Checker Error")
)
View Source
var (
	ErrEmptyExperiment = errors.New("Empty Experiment")
	ErrEmptyTestbed    = errors.New("Empty Testbed")
	ErrRlzBadXir       = errors.New("Bad Realzation XIR")
	ErrRlzInternal     = errors.New("Realization Internal")

	ErrFailedToRealize       = errors.New("Failed to Realize")
	ErrRealizeInProgress     = errors.New("Realization in Progress")
	ErrMaterializeInProgress = errors.New("Materialization in Progress")
	ErrBadRealizeAction      = errors.New("Bad Realize Action")

	ErrNoProjectResources = errors.New("No Resources For Project")
)

Functions

func ExplainDiagnostics

func ExplainDiagnostics(diagStr string) ([]string, error)

TODO redo for new diagnostics format

func Log

func Log(e error) error

Log log as Merge Error if possible, else just log.

func LogWithFields

func LogWithFields(e error, fields log.Fields) error

LogWithFields log as Merge Error if possible, else just log.

func ModelCheckerError added in v1.2.3

func ModelCheckerError(err error) error

func ModelReticulationError

func ModelReticulationError(err error) error

func MxCompileError

func MxCompileError(errStack string) error

func ToGRPCError

func ToGRPCError(e error) error

Types

type MergeError

type MergeError struct {
	Type      string `json:"type,omitempty"`
	Title     string `json:"title,omitempty"`
	Detail    string `json:"detail,omitempty"`
	Instance  string `json:"instance,omitempty"`
	Evidence  string `json:"evidence,omitempty"`
	Timestamp string `json:"timestamp,omitempty"`
	Err       error  `json:"err,omitempty"`
}

MergeError encapsulates an error in a Merge Portal. This currently mirrors the model.Error, but is written out again here to keep the API data structures separate from the internal Merge data structures. It also wraps the underlying error for tpe comparison and any other data it holds

Informational fields in the struct are based on RFC 7807 https://tools.ietf.org/html/rfc7807

func AlreadyExistsError

func AlreadyExistsError(what, instance string) *MergeError

func BadRealizeActionError

func BadRealizeActionError(badaction, instance string) *MergeError

func BadRequestError

func BadRequestError(detail string) *MergeError

func DataCorruptionError

func DataCorruptionError(name string, err error) *MergeError

func DatabaseError

func DatabaseError(detail string, err error) *MergeError

func EmptyExperimentError

func EmptyExperimentError() *MergeError

func EmptyTestbedError

func EmptyTestbedError() *MergeError

func ForbiddenError

func ForbiddenError(detail string) *MergeError

func FromGRPCError

func FromGRPCError(e error) *MergeError

func FromModelError

func FromModelError(e []byte) (*MergeError, error)

FromModelError - convert from Merge API error to MergeError

func InternalError

func InternalError(title, detail, eType string, err error) *MergeError

InternalError is wrapped in a MergeError

func MaterializeInProgressError added in v1.2.3

func MaterializeInProgressError(id string) *MergeError

func NewMergeError

func NewMergeError(err error) *MergeError

func NoProjectResources

func NoProjectResources(pid string) *MergeError

func NotFoundError

func NotFoundError(what, instance string) *MergeError

func RealizeInProgressError added in v1.2.3

func RealizeInProgressError(id string) *MergeError

func SvcConnectionError

func SvcConnectionError(name string, err error) *MergeError

func ToMergeError

func ToMergeError(err error) *MergeError

ToMergeError - Given an arbitrary error, convert to MergeError

func UnauthorizedError

func UnauthorizedError(detail string) *MergeError

func UncategorizedError

func UncategorizedError(detail string, err error) *MergeError

func UserInactiveError added in v1.1.22

func UserInactiveError(detail string) *MergeError

func (MergeError) Error

func (me MergeError) Error() string

Error implements the go error interface.

func (*MergeError) Is

func (me *MergeError) Is(target error) bool

func (*MergeError) Log

func (me *MergeError) Log() error

Log this error at the Error level. Returns itself.

func (*MergeError) LogWithFields

func (me *MergeError) LogWithFields(flds log.Fields) error

LogWithFields logs the error and returns itself

func (*MergeError) String

func (me *MergeError) String() string

ToString "translates" the error to a pretty printed string suitable for dumping to stdout/stderr.

func (*MergeError) Unwrap

func (me *MergeError) Unwrap() error

Jump to

Keyboard shortcuts

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