errutil

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package errutil provides common error handling tools NOTE: Subject to change, do not rely on this package from outside git-lfs source

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(err error) error

Error wraps an error with an empty message.

func ErrorContext

func ErrorContext(err error) map[string]interface{}

ErrorContext returns the context map for an error if it is a wrappedError. If it is not a wrappedError it will return an empty map.

func ErrorDelContext

func ErrorDelContext(err error, key string)

ErrorDelContext removes a value from the error's context. If the error has not been wrapped, it does nothing.

func ErrorGetContext

func ErrorGetContext(err error, key string) interface{}

ErrorGetContext gets a value from the error's context. If the error has not been wrapped, it returns an empty string.

func ErrorSetContext

func ErrorSetContext(err error, key string, value interface{})

ErrorSetContext sets a value in the error's context. If the error has not been wrapped, it does nothing.

func ErrorStack

func ErrorStack(err error) []byte

ErrorStack returns the stack for an error if it is a wrappedError. If it is not a wrappedError it will return an empty byte slice.

func Errorf

func Errorf(err error, format string, args ...interface{}) error

Errorf wraps an error with an additional formatted message.

func GetInnerError

func GetInnerError(err error) error

func IsAuthError

func IsAuthError(err error) bool

IsAuthError indicates the client provided a request with invalid or no authentication credentials when credentials are required (e.g. HTTP 401).

func IsBadPointerKeyError

func IsBadPointerKeyError(err error) bool

IsBadPointerKeyError indicates that the parsed data has an invalid key.

func IsCleanPointerError

func IsCleanPointerError(err error) bool

IsCleanPointerError indicates an error while cleaning a file.

func IsDownloadDeclinedError

func IsDownloadDeclinedError(err error) bool

IsDownloadDeclinedError indicates that the smudge operation should not download. TODO: I don't really like using errors to control that flow, it should be refactored.

func IsFatalError

func IsFatalError(err error) bool

IsFatalError indicates that the error is fatal and the process should exit immediately after handling the error.

func IsInvalidPointerError

func IsInvalidPointerError(err error) bool

IsInvalidPointerError indicates an attempt to parse data that was not a valid pointer.

func IsInvalidRepoError

func IsInvalidRepoError(err error) bool

IsInvalidRepoError indicates an operation was attempted from outside a git repository.

func IsNotAPointerError

func IsNotAPointerError(err error) bool

IsNotAPointerError indicates the parsed data is not an LFS pointer.

func IsNotImplementedError

func IsNotImplementedError(err error) bool

IsNotImplementedError indicates the client attempted to use a feature the server has not implemented (e.g. the batch endpoint).

func IsRetriableError

func IsRetriableError(err error) bool

IsRetriableError indicates the low level transfer had an error but the caller may retry the operation.

func IsSmudgeError

func IsSmudgeError(err error) bool

IsSmudgeError indicates an error while smudging a files.

func NewAuthError

func NewAuthError(err error) error

func NewBadPointerKeyError

func NewBadPointerKeyError(expected, actual string) error

func NewCleanPointerError

func NewCleanPointerError(err error, pointer interface{}, bytes []byte) error

func NewDownloadDeclinedError

func NewDownloadDeclinedError(err error) error

func NewFatalError

func NewFatalError(err error) error

func NewInvalidPointerError

func NewInvalidPointerError(err error) error

func NewInvalidRepoError

func NewInvalidRepoError(err error) error

func NewNotAPointerError

func NewNotAPointerError(err error) error

func NewNotImplementedError

func NewNotImplementedError(err error) error

func NewRetriableError

func NewRetriableError(err error) error

func NewSmudgeError

func NewSmudgeError(err error, oid, filename string) error

func Stack

func Stack() []byte

Stack returns a byte slice containing the runtime.Stack()

func StandardizeBadPointerError

func StandardizeBadPointerError(err error) error

If an error is abad pointer error of any type, returns NotAPointerError

Types

This section is empty.

Jump to

Keyboard shortcuts

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