Use eris for error management

This commit is contained in:
Jamie Curnow committed 2023-02-24 17:19:07 +10:00
1 parent 80315bd50e
commit c288886fd4
44 files changed
+173 -128

No files matched your search

+4 -3
View File
@@ -2,7 +2,8 @@ package jobqueue
import (
"context"
"errors"
"github.com/rotisserie/eris"
)
var (
@@ -30,7 +31,7 @@ func Start() {
// Shutdown will gracefully stop the queue
func Shutdown() error {
if cancel == nil {
return errors.New("Unable to shutdown, jobqueue has not been started")
return eris.New("Unable to shutdown, jobqueue has not been started")
}
cancel()
return nil
@@ -39,7 +40,7 @@ func Shutdown() error {
// AddJob adds a job to the queue for processing
func AddJob(j Job) error {
if worker == nil {
return errors.New("Unable to add job, jobqueue has not been started")
return eris.New("Unable to add job, jobqueue has not been started")
}
worker.Queue.AddJob(j)
return nil