From 0725ebf24da4d3f06097372e31c05a49543edc79 Mon Sep 17 00:00:00 2001 From: Keuin Date: Fri, 16 Sep 2022 02:30:24 +0800 Subject: Bugfix: empty files will be created if the live room is opened but the live hasn't started yet --- common/errors.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'common') 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} +} -- cgit v1.2.3