aboutsummaryrefslogtreecommitdiffstats
path: root/core/errors.go
diff options
context:
space:
mode:
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())
+}