exception

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultFormattingStrategy

type DefaultFormattingStrategy struct {
	FrameCount int
}

DefaultFormattingStrategy is the default implementation of the ExceptionFormattingStrategy and has a configurable frame count.

func NewDefaultFormattingStrategy

func NewDefaultFormattingStrategy() (*DefaultFormattingStrategy, error)

NewDefaultFormattingStrategy initializes DefaultFormattingStrategy with default value of frame count.

func NewDefaultFormattingStrategyWithDefinedErrorFrameCount

func NewDefaultFormattingStrategyWithDefinedErrorFrameCount(frameCount int) (*DefaultFormattingStrategy, error)

NewDefaultFormattingStrategyWithDefinedErrorFrameCount initializes DefaultFormattingStrategy with customer defined frame count.

func (*DefaultFormattingStrategy) Error

func (dEFS *DefaultFormattingStrategy) Error(message string) *XRayError

Error returns the value of XRayError by given error message.

func (*DefaultFormattingStrategy) Errorf

func (dEFS *DefaultFormattingStrategy) Errorf(formatString string, args ...interface{}) *XRayError

Errorf formats according to a format specifier and returns value of XRayError.

func (*DefaultFormattingStrategy) ExceptionFromError

func (dEFS *DefaultFormattingStrategy) ExceptionFromError(err error) Exception

ExceptionFromError takes an error and returns value of Exception

func (*DefaultFormattingStrategy) Panic

func (dEFS *DefaultFormattingStrategy) Panic(message string) *XRayError

Panic records error type as panic in segment and returns value of XRayError.

func (*DefaultFormattingStrategy) Panicf

func (dEFS *DefaultFormattingStrategy) Panicf(formatString string, args ...interface{}) *XRayError

Panicf formats according to a format specifier and returns value of XRayError.

type Exception

type Exception struct {
	ID      string  `json:"id,omitempty"`
	Type    string  `json:"type,omitempty"`
	Message string  `json:"message,omitempty"`
	Stack   []Stack `json:"stack,omitempty"`
}

Exception provides the shape for unmarshaling an exception.

type FormattingStrategy

type FormattingStrategy interface {
	Error(message string) *XRayError
	Errorf(formatString string, args ...interface{}) *XRayError
	Panic(message string) *XRayError
	Panicf(formatString string, args ...interface{}) *XRayError
	ExceptionFromError(err error) Exception
}

FormattingStrategy provides an interface for implementing methods that format errors and exceptions.

type MultiError

type MultiError []error

MultiError is a type for a slice of error.

func (MultiError) Error

func (e MultiError) Error() string

Error returns a string format of concatenating multiple errors.

type Stack

type Stack struct {
	Path  string `json:"path,omitempty"`
	Line  int    `json:"line,omitempty"`
	Label string `json:"label,omitempty"`
}

Stack provides the shape for unmarshaling an stack.

type StackTracer

type StackTracer interface {
	StackTrace() []uintptr
}

StackTracer is an interface for implementing StackTrace method.

type XRayError

type XRayError struct {
	Type    string
	Message string
	Stack   []uintptr
}

XRayError records error type, message, and a slice of stack frame pointers.

func (*XRayError) Error

func (e *XRayError) Error() string

Error returns the value of error message.

func (*XRayError) StackTrace

func (e *XRayError) StackTrace() []uintptr

StackTrace returns a slice of integer pointers.

Jump to

Keyboard shortcuts

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