Documentation
¶
Overview ¶
Package errors provides an identical API to the popular github.com/pkg/errors package. It also provides several feature enhancements.
Stack Traces ¶
github.com/pkg/errors includes a stacktrace for every wrapped call. This creates a lot of noise in applications since we prefer to always a wrap an error to ensure a logged error always has a stacktrace. This package attempts to remove stack traces when it can detect the traces have a shared caller. Typically you are left with only the root stack trace.
Index ¶
- Constants
- func AddStack(err error) error
- func As(err error, target interface{}) bool
- func Cause(err error) error
- func Error(msg string) error
- func ErrorEqual(err1 error, err2 error) bool
- func Errorf(format string, args ...interface{}) error
- func Is(err, target error) bool
- func MaybeConvertToPranaErrorf(err error, errorCode ErrorCode, msgFormat string, args ...interface{}) error
- func New(message string) error
- func Trace(err error) error
- func WithStack(err error) error
- func Wrap(err error, message string) error
- type ErrorCode
- type PranaError
- func NewIndexAlreadyExistsError(schemaName string, tableName string, indexName string) PranaError
- func NewInternalError(errReference string) PranaError
- func NewInvalidConfigurationError(msg string) PranaError
- func NewInvalidStatementError(msg string) PranaError
- func NewMaterializedViewHasChildrenError(schemaName string, materializedViewName string, childMVs []string) PranaError
- func NewPranaError(errorCode ErrorCode, msg string) PranaError
- func NewPranaErrorf(errorCode ErrorCode, msgFormat string, args ...interface{}) PranaError
- func NewSchemaNotInUseError() PranaError
- func NewSourceHasChildrenError(schemaName string, sourceName string, childMVs []string) PranaError
- func NewUnknownIndexError(schemaName string, tableName string, indexName string) PranaError
- func NewUnknownLoadRunnerfCommandError(commandName string) PranaError
- func NewUnknownMaterializedViewError(schemaName string, mvName string) PranaError
- func NewUnknownSourceError(schemaName string, sourceName string) PranaError
- func NewUnknownTableError(schemaName string, tableName string) PranaError
- func NewValueOutOfRangeError(msg string) PranaError
Constants ¶
const ( InvalidStatement = iota + 1000 SchemaNotInUse UnknownSource UnknownMaterializedView UnknownIndex UnknownTable SourceAlreadyExists MaterializedViewAlreadyExists IndexAlreadyExists SourceHasChildren MaterializedViewHasChildren InvalidParamCount Timeout DdlCancelled DdlRetry )
User errors
const ( ValueOutOfRange = iota + 2000 VarcharTooBig )
Ingest errors
const ( InvalidConfiguration = 3000 UnknownPerfCommand = 4000 InternalError = 5000 )
Miscellaneous errors
Variables ¶
This section is empty.
Functions ¶
func As ¶
As finds the first error in err's chain that matches target, and if so, sets target to that error value and returns true.
The chain consists of err itself followed by the sequence of errors obtained by repeatedly calling Unwrap.
An error matches target if the error's concrete value is assignable to the value pointed to by target, or if the error has a method As(interface{}) bool such that As(target) returns true. In the latter case, the As method is responsible for setting target.
As will panic if target is not a non-nil pointer to either a type that implements error, or to any interface type. As returns false if err is nil.
func Cause ¶
Cause returns the underlying cause of the error, if possible. An error value has a cause if it implements the following interface:
type causer interface {
Cause() error
}
If the error does not implement Cause, the original error will be returned. If the error is nil, nil will be returned without further investigation.
func ErrorEqual ¶
func Errorf ¶
Errorf formats according to a format specifier and returns the string as a value that satisfies error. Errorf also records the stack trace at the point it was called.
func Is ¶
Is reports whether any error in err's chain matches target.
The chain consists of err itself followed by the sequence of errors obtained by repeatedly calling Unwrap.
An error is considered to match a target if it is equal to that target or if it implements a method Is(error) bool such that Is(target) returns true.
func MaybeConvertToPranaErrorf ¶ added in v0.1.1
func New ¶
New returns an error with the supplied message. New also records the stack trace at the point it was called.
Types ¶
type PranaError ¶
PranaError is any kind of error that is exposed to the user via external interfaces like the CLI
func NewIndexAlreadyExistsError ¶
func NewIndexAlreadyExistsError(schemaName string, tableName string, indexName string) PranaError
func NewInternalError ¶
func NewInternalError(errReference string) PranaError
func NewInvalidConfigurationError ¶
func NewInvalidConfigurationError(msg string) PranaError
func NewInvalidStatementError ¶
func NewInvalidStatementError(msg string) PranaError
func NewMaterializedViewHasChildrenError ¶
func NewMaterializedViewHasChildrenError(schemaName string, materializedViewName string, childMVs []string) PranaError
func NewPranaError ¶
func NewPranaError(errorCode ErrorCode, msg string) PranaError
func NewPranaErrorf ¶
func NewPranaErrorf(errorCode ErrorCode, msgFormat string, args ...interface{}) PranaError
func NewSchemaNotInUseError ¶
func NewSchemaNotInUseError() PranaError
func NewSourceHasChildrenError ¶
func NewSourceHasChildrenError(schemaName string, sourceName string, childMVs []string) PranaError
func NewUnknownIndexError ¶
func NewUnknownIndexError(schemaName string, tableName string, indexName string) PranaError
func NewUnknownLoadRunnerfCommandError ¶
func NewUnknownLoadRunnerfCommandError(commandName string) PranaError
func NewUnknownMaterializedViewError ¶
func NewUnknownMaterializedViewError(schemaName string, mvName string) PranaError
func NewUnknownSourceError ¶
func NewUnknownSourceError(schemaName string, sourceName string) PranaError
func NewUnknownTableError ¶ added in v0.1.1
func NewUnknownTableError(schemaName string, tableName string) PranaError
func NewValueOutOfRangeError ¶
func NewValueOutOfRangeError(msg string) PranaError
func (PranaError) Error ¶
func (u PranaError) Error() string