summaryrefslogtreecommitdiff
path: root/recording/errors.go
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-09-14 03:02:51 +0800
committerKeuin <[email protected]>2022-09-14 03:04:52 +0800
commit7902849dc021610b0ec16d1130b9515efd1f64b1 (patch)
tree058c1aca3a4947f75b0ba73f6f205498a1e186e5 /recording/errors.go
parented3db79b86e9ea2c796cccedf1454a45823293a4 (diff)
Refactor: proper error handling.v0.3.3
Diffstat (limited to 'recording/errors.go')
-rw-r--r--recording/errors.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/recording/errors.go b/recording/errors.go
new file mode 100644
index 0000000..48a492e
--- /dev/null
+++ b/recording/errors.go
@@ -0,0 +1,33 @@
+package recording
+
+import "fmt"
+
+/*
+Task errors.
+*/
+
+type RecoverableTaskError struct {
+ err error
+ message string
+}
+
+func (e *RecoverableTaskError) Error() string {
+ return fmt.Sprintf("%v: %v", e.message, e.err)
+}
+
+func NewRecoverableTaskError(message string, err error) error {
+ return &RecoverableTaskError{message: message, err: err}
+}
+
+type UnrecoverableTaskError struct {
+ err error
+ message string
+}
+
+func (e *UnrecoverableTaskError) Error() string {
+ return fmt.Sprintf("%v: %v", e.message, e.err)
+}
+
+func NewUnrecoverableTaskError(message string, err error) error {
+ return &UnrecoverableTaskError{message: message, err: err}
+}