aboutsummaryrefslogtreecommitdiffstats
path: root/core/errors.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2015-10-31 01:14:03 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2015-10-31 01:14:03 +0100
commitc6349552c1c54ea114b92ae23fc840f68f6551f4 (patch)
tree6fbaf514ae9caf8241a0b9dfc3709d60942876c5 /core/errors.go
parentfe1fc1aa7dca3e0f6e54ab17f0acfa45f269e58c (diff)
downloadgo-git-c6349552c1c54ea114b92ae23fc840f68f6551f4.tar.gz
internal -> core
Diffstat (limited to 'core/errors.go')
-rw-r--r--core/errors.go35
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())
+}