diff --git a/database/sql/jobs.go b/database/sql/jobs.go index 2dfadf13..887e041f 100644 --- a/database/sql/jobs.go +++ b/database/sql/jobs.go @@ -142,11 +142,10 @@ func (s *sqlDatabase) LockJob(_ context.Context, jobID int64, entityID string) e } asParams, err := sqlWorkflowJobToParamsJob(workflowJob) - if err == nil { - s.sendNotify(common.JobEntityType, common.UpdateOperation, asParams) - } else { - slog.With(slog.Any("error", err)).Error("failed to convert job to params") + if err != nil { + return errors.Wrap(err, "converting job") } + s.sendNotify(common.JobEntityType, common.UpdateOperation, asParams) return nil } @@ -172,11 +171,10 @@ func (s *sqlDatabase) BreakLockJobIsQueued(_ context.Context, jobID int64) (err return errors.Wrap(err, "saving job") } asParams, err := sqlWorkflowJobToParamsJob(workflowJob) - if err == nil { - s.sendNotify(common.JobEntityType, common.UpdateOperation, asParams) - } else { - slog.With(slog.Any("error", err)).Error("failed to convert job to params") + if err != nil { + return errors.Wrap(err, "converting job") } + s.sendNotify(common.JobEntityType, common.UpdateOperation, asParams) return nil } @@ -206,11 +204,10 @@ func (s *sqlDatabase) UnlockJob(_ context.Context, jobID int64, entityID string) } asParams, err := sqlWorkflowJobToParamsJob(workflowJob) - if err == nil { - s.sendNotify(common.JobEntityType, common.UpdateOperation, asParams) - } else { - slog.With(slog.Any("error", err)).Error("failed to convert job to params") + if err != nil { + return errors.Wrap(err, "converting job") } + s.sendNotify(common.JobEntityType, common.UpdateOperation, asParams) return nil }