diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2015-10-31 01:14:03 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2015-10-31 01:14:03 +0100 |
commit | c6349552c1c54ea114b92ae23fc840f68f6551f4 (patch) | |
tree | 6fbaf514ae9caf8241a0b9dfc3709d60942876c5 /core/errors.go | |
parent | fe1fc1aa7dca3e0f6e54ab17f0acfa45f269e58c (diff) | |
download | go-git-c6349552c1c54ea114b92ae23fc840f68f6551f4.tar.gz |
internal -> core
Diffstat (limited to 'core/errors.go')
-rw-r--r-- | core/errors.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/core/errors.go b/core/errors.go new file mode 100644 index 0000000..fd1133e --- /dev/null +++ b/core/errors.go @@ -0,0 +1,35 @@ +package core + +import "fmt" + +type PermanentError struct { + err error +} + +func NewPermanentError(err error) *PermanentError { + if err == nil { + return nil + } + + return &PermanentError{err: err} +} + +func (e *PermanentError) Error() string { + return fmt.Sprintf("permanent client error: %s", e.err.Error()) +} + +type UnexpectedError struct { + err error +} + +func NewUnexpectedError(err error) *UnexpectedError { + if err == nil { + return nil + } + + return &UnexpectedError{err: err} +} + +func (e *UnexpectedError) Error() string { + return fmt.Sprintf("unexpected client error: %s", e.err.Error()) +} |