summaryrefslogtreecommitdiff
path: root/sync_worker.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-11-09 15:11:10 +0300
committerGitHub <[email protected]>2020-11-09 15:11:10 +0300
commit0874bcb2f6b284a940ba4f3507eb8c4619c27868 (patch)
treec99d15624cd080cad22b7c8fb7d4714b2dc124fb /sync_worker.go
parent9fbe7726dd55cfedda724b7644e1b6bf7c1a6cb4 (diff)
parentf218dcbd7e55d9ad1df8336e2331cdaa62d9ded3 (diff)
Merge pull request #390 from spiral/feature/switch_to_spiral_errorsv2.0.0-alpha17
Feature/switch to spiral errors
Diffstat (limited to 'sync_worker.go')
-rwxr-xr-xsync_worker.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/sync_worker.go b/sync_worker.go
index 282254e5..a9c53553 100755
--- a/sync_worker.go
+++ b/sync_worker.go
@@ -50,7 +50,8 @@ func (tw *syncWorker) Exec(p Payload) (Payload, error) {
rsp, err := tw.execPayload(p)
if err != nil {
- if _, ok := err.(ExecError); !ok {
+ // just to be more verbose
+ if errors.Is(errors.Exec, err) == false {
tw.w.State().Set(StateErrored)
tw.w.State().RegisterExec()
}
@@ -95,7 +96,8 @@ func (tw *syncWorker) ExecWithContext(ctx context.Context, p Payload) (Payload,
rsp, err := tw.execPayload(p)
if err != nil {
- if _, ok := err.(ExecError); !ok {
+ // just to be more verbose
+ if errors.Is(errors.Exec, err) == false {
tw.w.State().Set(StateErrored)
tw.w.State().RegisterExec()
}
@@ -131,7 +133,7 @@ func (tw *syncWorker) ExecWithContext(ctx context.Context, p Payload) (Payload,
}
func (tw *syncWorker) execPayload(p Payload) (Payload, error) {
- const op = errors.Op("exec_payload")
+ const op = errors.Op("exec payload")
// two things; todo: merge
if err := sendControl(tw.w.Relay(), p.Context); err != nil {
return EmptyPayload, errors.E(op, err, "header error")
@@ -154,7 +156,7 @@ func (tw *syncWorker) execPayload(p Payload) (Payload, error) {
}
if pr.HasFlag(goridge.PayloadError) {
- return EmptyPayload, ExecError(rsp.Context)
+ return EmptyPayload, errors.E(op, errors.Exec, errors.Str(string(rsp.Context)))
}
// add streaming support :)