From 76b0ea639836375d8726a1cea0c137a5dca2fafe Mon Sep 17 00:00:00 2001 From: Jyotinder Singh Date: Sun, 17 Nov 2024 16:16:57 +0530 Subject: [PATCH] Fixes error assertion --- internal/worker/worker.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/worker/worker.go b/internal/worker/worker.go index 49b265f00..f02d1e639 100644 --- a/internal/worker/worker.go +++ b/internal/worker/worker.go @@ -219,10 +219,9 @@ func (w *BaseWorker) executeCommand(ctx context.Context, diceDBCmd *cmd.DiceDBCm if err != nil { var workerErr error // Check if it's a CustomError - if customErr, ok := err.(*diceerrors.PreProcessError); ok { + var customErr *diceerrors.PreProcessError + if errors.As(err, &customErr) { workerErr = w.ioHandler.Write(ctx, customErr.Result) - } else { - workerErr = w.ioHandler.Write(ctx, err) } if workerErr != nil { slog.Debug("Error executing for worker", slog.String("workerID", w.id), slog.Any("error", workerErr))