summaryrefslogtreecommitdiff
path: root/bilibili/errors/errors.go
diff options
context:
space:
mode:
Diffstat (limited to 'bilibili/errors/errors.go')
-rw-r--r--bilibili/errors/errors.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/bilibili/errors/errors.go b/bilibili/errors/errors.go
new file mode 100644
index 0000000..2b810ed
--- /dev/null
+++ b/bilibili/errors/errors.go
@@ -0,0 +1,43 @@
+package errors
+
+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 (e *RecoverableTaskError) Unwrap() error {
+ return 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 (e *UnrecoverableTaskError) Unwrap() error {
+ return e.err
+}
+
+func NewUnrecoverableTaskError(message string, err error) error {
+ return &UnrecoverableTaskError{message: message, err: err}
+}