errors

package
v2.5.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: MIT Imports: 4 Imported by: 7

Documentation

Overview

Package errors 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 Cause

func Cause(err error) error

func Combine

func Combine(errs []error) error

func Context

func Context(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 DelContext

func DelContext(err error, key string)

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

func Errorf

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

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 GetContext

func GetContext(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 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 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 IsUnprocessableEntityError

func IsUnprocessableEntityError(err error) bool

IsDownloadDeclinedError indicates that the upload operation failed because of an HTTP 422 response code.

func New

func New(message string) error

New returns an error with the supplied message. New also records the stack trace at thepoint it was called.

func NewAuthError

func NewAuthError(err error) error

func NewBadPointerKeyError

func NewBadPointerKeyError(expected, actual string) error

func NewCleanPointerError

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

func NewDownloadDeclinedError

func NewDownloadDeclinedError(err error, msg string) error

func NewFatalError

func NewFatalError(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 NewUnprocessableEntityError

func NewUnprocessableEntityError(err error) error

func SetContext

func SetContext(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 StackTrace

func StackTrace(err error) []string

func StandardizeBadPointerError

func StandardizeBadPointerError(err error) error

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

func Wrap

func Wrap(err error, msg string) error

Wrap wraps an error with an additional message.

func Wrapf

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

Wrapf wraps an error with an additional formatted message.

Types

This section is empty.

Jump to

Keyboard shortcuts

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