summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-09-16 02:30:24 +0800
committerKeuin <[email protected]>2022-09-16 02:30:24 +0800
commit0725ebf24da4d3f06097372e31c05a49543edc79 (patch)
tree7ddd83c555d446b00271fa29f55d1316e0d11766 /common
parent12c856a10cb9c59ae97504ce0fcd9fdb044bdd14 (diff)
Bugfix: empty files will be created if the live room is opened but the live hasn't started yet
Diffstat (limited to 'common')
-rw-r--r--common/errors.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/common/errors.go b/common/errors.go
index ba686f1..fa2d492 100644
--- a/common/errors.go
+++ b/common/errors.go
@@ -2,6 +2,7 @@ package common
import (
"errors"
+ "fmt"
"reflect"
)
@@ -27,3 +28,33 @@ func IsErrorOfType(err, target error) bool {
}
}
}
+
+/*
+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}
+}