From: Anderson A. Giacomolli Date: Wed, 11 Nov 2026 15:35:21 +0000 (-0300) Subject: Return known failures without redundant checks X-Git-Url: https://git.giacomolli.uk/onechat/commitdiff_plain/4a42f7f208cbfead335eba9ebe615b35b1742130?ds=inline Return known failures without redundant checks Telegram update failures and worker state-save failures return their wrapped errors directly inside existing failure branches. A compaction without a line also returns its known failure directly. Unreachable nil returns and repeated conditions are removed without changing error causes or successful paths. Issue: 3cdc678 --- diff --git a/compactor.go b/compactor.go index 2b06288..64ff1fd 100644 --- a/compactor.go +++ b/compactor.go @@ -110,11 +110,7 @@ func (c *Compactor) Summarize(ctx context.Context, task Task) (string, error) { } if len(lines) == 0 { - if err != nil { - return "", fmt.Errorf("summarize node: %w", err) - } - - return "", nil + return "", fmt.Errorf("summarize node: %w", err) } return compactorShortest(lines), nil diff --git a/subagent_run.go b/subagent_run.go index 54fa430..ca45976 100644 --- a/subagent_run.go +++ b/subagent_run.go @@ -215,11 +215,7 @@ func (r *SubagentRuns) start(ctx context.Context, run *SubagentRun) error { r.mutex.Unlock() run.cancel() - if err != nil { - return fmt.Errorf("save running workers: %w", err) - } - - return nil + return fmt.Errorf("save running workers: %w", err) } r.workers.Add(1) diff --git a/telegram.go b/telegram.go index 85b0f44..3d676d6 100644 --- a/telegram.go +++ b/telegram.go @@ -313,11 +313,7 @@ poll: continue poll } - if err != nil { - return fmt.Errorf("handle Telegram update: %w", err) - } - - return nil + return fmt.Errorf("handle Telegram update: %w", err) } imageOutage.End()