summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-09-16 20:26:59 +0800
committerKeuin <[email protected]>2022-09-16 20:26:59 +0800
commit7d8ec5f208c645fef71e2b1fd9ce1f891edfda45 (patch)
treeae102ec8d89c2d526b2fe8a2d3af3c8ed0e33404 /common
parent0725ebf24da4d3f06097372e31c05a49543edc79 (diff)
Bugfix: Ctrl-C won't stop the task.
Diffstat (limited to 'common')
-rw-r--r--common/errors.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/common/errors.go b/common/errors.go
index fa2d492..62899c1 100644
--- a/common/errors.go
+++ b/common/errors.go
@@ -42,6 +42,10 @@ 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}
}
@@ -55,6 +59,10 @@ 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}
}