diff options
Diffstat (limited to 'formats/packfile/error.go')
-rw-r--r-- | formats/packfile/error.go | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/formats/packfile/error.go b/formats/packfile/error.go deleted file mode 100644 index c0b9163..0000000 --- a/formats/packfile/error.go +++ /dev/null @@ -1,30 +0,0 @@ -package packfile - -import "fmt" - -// Error specifies errors returned during packfile parsing. -type Error struct { - reason, details string -} - -// NewError returns a new error. -func NewError(reason string) *Error { - return &Error{reason: reason} -} - -// Error returns a text representation of the error. -func (e *Error) Error() string { - if e.details == "" { - return e.reason - } - - return fmt.Sprintf("%s: %s", e.reason, e.details) -} - -// AddDetails adds details to an error, with additional text. -func (e *Error) AddDetails(format string, args ...interface{}) *Error { - return &Error{ - reason: e.reason, - details: fmt.Sprintf(format, args...), - } -} |