merror

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: Apache-2.0 Imports: 12 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")
	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")
)
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")
	ErrBadRealizeAction = errors.New("Bad Realize Action")

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

Functions

func ExplainDiagnostics

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

ExplainDiagnostics generates human readable string about the diagnostics suitable for display to a human.

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 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 DatabaseError

func DatabaseError(detail string, err error) *MergeError

func EmptyExperimentError

func EmptyExperimentError() *MergeError

func EmptyTestbedError

func EmptyTestbedError() *MergeError

func FailedToRealizeError

func FailedToRealizeError(rid string, diags []*rz.Diagnostic) *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 NewMergeError

func NewMergeError(err error) *MergeError

func NoProjectResources

func NoProjectResources(pid string) *MergeError

func NotFoundError

func NotFoundError(what, instance 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 (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) ModelError

func (me *MergeError) ModelError() *models.Error

Error conversions: from error, from/to GRPC, to API (models.Error)

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