porterr

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2019 License: BSD-2-Clause Imports: 3 Imported by: 21

README

porterr

Golang Error with details

Documentation

Index

Constants

View Source
const (
	PortErrorSystem        = "PORTABLE_ERROR_SYSTEM"
	PortErrorClient        = "PORTABLE_ERROR_CLIENT"
	PortErrorDatabaseQuery = "PORTABLE_ERROR_DATABASE"
	PortErrorConsole       = "PORTABLE_ERROR_CONSOLE"
	PortErrorLogic         = "PORTABLE_ERROR_LOGIC"
	PortErrorRequest       = "PORTABLE_ERROR_REQUEST"
	PortErrorResponse      = "PORTABLE_ERROR_RESPONSE"
	PortErrorConflict      = "PORTABLE_ERROR_CONFLICT"
	PortErrorTransaction   = "PORTABLE_ERROR_TRANSACTION"
	PortErrorConnection    = "PORTABLE_ERROR_CONNECTION"
	PortErrorUpdate        = "PORTABLE_ERROR_UPDATE"
	PortErrorCreate        = "PORTABLE_ERROR_CREATE"
	PortErrorDelete        = "PORTABLE_ERROR_DELETE"
	PortErrorLoad          = "PORTABLE_ERROR_LOAD"
	PortErrorSearch        = "PORTABLE_ERROR_SEARCH"
	PortErrorParam         = "PORTABLE_ERROR_PARAM"
	PortErrorValidation    = "PORTABLE_ERROR_VALIDATION"
	PortErrorScript        = "PORTABLE_ERROR_SCRIPT"
	PortErrorDescriptor    = "PORTABLE_ERROR_DESCRIPTOR"
	PortErrorNotification  = "PORTABLE_ERROR_NOTIFICATION"
	PortErrorConsumer      = "PORTABLE_ERROR_CONSUMER"
	PortErrorProducer      = "PORTABLE_ERROR_PRODUCER"
	PortErrorCore          = "PORTABLE_ERROR_CORE"
	PortErrorHandler       = "PORTABLE_ERROR_HANDLER"
	PortErrorAccess        = "PORTABLE_ERROR_ACCESS"
	PortErrorPermission    = "PORTABLE_ERROR_PERMISSION"
	PortErrorAuth          = "PORTABLE_ERROR_AUTH"
	PortErrorMigration     = "PORTABLE_ERROR_MIGRATION"
	PortErrorType          = "PORTABLE_ERROR_TYPE"
	PortErrorFunction      = "PORTABLE_ERROR_FUNCTION"
	PortErrorEncoder       = "PORTABLE_ERROR_ENCODER"
	PortErrorDecoder       = "PORTABLE_ERROR_DECODER"
	PortErrorReader        = "PORTABLE_ERROR_READER"
	PortErrorWriter        = "PORTABLE_ERROR_WRITER"
	PortErrorCloser        = "PORTABLE_ERROR_CLOSER"
	PortErrorTemplate      = "PORTABLE_ERROR_TEMPLATE"
	PortErrorCommand       = "PORTABLE_ERROR_COMMAND"
	PortErrorProcess       = "PORTABLE_ERROR_PROCESS"
	PortErrorIO            = "PORTABLE_ERROR_IO"
	PortErrorRender        = "PORTABLE_ERROR_RENDER"
	PortErrorState         = "PORTABLE_ERROR_STATE"
	PortErrorMemory        = "PORTABLE_ERROR_MEMORY"
	PortErrorNetwork       = "PORTABLE_ERROR_NETWORK"
	PortErrorDevice        = "PORTABLE_ERROR_DEVICE"
	PortErrorRecursion     = "PORTABLE_ERROR_RECURSION"
	PortErrorArgument      = "PORTABLE_ERROR_ARGUMENT"
	PortErrorBody          = "PORTABLE_ERROR_BODY"
	PortErrorHeader        = "PORTABLE_ERROR_HEADER"
	PortErrorProtocol      = "PORTABLE_ERROR_PROTOCOL"
	PortErrorSize          = "PORTABLE_ERROR_SIZE"
	PortErrorPriority      = "PORTABLE_ERROR_PRIORITY"
	PortErrorCondition     = "PORTABLE_ERROR_CONDITION"
	PortErrorIteration     = "PORTABLE_ERROR_ITERATION"
	PortErrorParser        = "PORTABLE_ERROR_PARSER"
	PortErrorEnvelop       = "PORTABLE_ERROR_ENVELOP"
	PortErrorEnvironment   = "PORTABLE_ERROR_ENVIRONMENT"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorData

type ErrorData struct {
	Message string      // Error message
	Code    interface{} // Code message
	Name    string      // Name of detail
	// contains filtered or unexported fields
}

Detailed error

type IError

type IError interface {
	Error() string                                                   // Error interface std
	GetStack() []byte                                                // Get stacktrace
	GetDetails() []IError                                            // Get error details
	PushDetail(message string, code interface{}, name string) IError // Add error detail
	PopDetail() IError                                               // Get detail from
	FlushDetails() IError                                            // Reset all details
}

Common Error Interface

func New

func New(code interface{}, message string) IError

New error

func NewF

func NewF(code interface{}, message string, args ...interface{}) IError

New error

func NewFWithName

func NewFWithName(code interface{}, name string, message string, args ...interface{}) IError

New error with name

func NewWithName

func NewWithName(code interface{}, name string, message string) IError

New error with name

type PortError

type PortError struct {
	ErrorData // Error data
	// contains filtered or unexported fields
}

Portable error

func (*PortError) Error

func (e *PortError) Error() string

Interface error method

func (*PortError) FlushDetails

func (e *PortError) FlushDetails() IError

Flush detail

func (*PortError) GetDetails

func (e *PortError) GetDetails() []IError

Interface error get details

func (*PortError) GetStack

func (e *PortError) GetStack() []byte

Interface error get stack

func (*PortError) MarshalJSON

func (e *PortError) MarshalJSON() ([]byte, error)

Std error marshal

func (*PortError) PopDetail

func (e *PortError) PopDetail() IError

Pop detail

func (*PortError) PushDetail

func (e *PortError) PushDetail(message string, code interface{}, name string) IError

Interface error push detail

func (*PortError) UnmarshalJSON

func (e *PortError) UnmarshalJSON(data []byte) error

Unmarshal error

Jump to

Keyboard shortcuts

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