Skip to content

Adopt shared errorMessage() in agents.ts and templates.ts - #608

Merged
selfcontained merged 1 commit into
mainfrom
tech-debt/adopt-error-message-helper
May 27, 2026
Merged

Adopt shared errorMessage() in agents.ts and templates.ts#608
selfcontained merged 1 commit into
mainfrom
tech-debt/adopt-error-message-helper

Conversation

@selfcontained

Copy link
Copy Markdown
Owner

Summary

  • Replaced 5 inline error instanceof Error ? error.message : "..." patterns in agents.ts with the shared errorMessage() helper from shared/lib/error-message.ts
  • Replaced 2 remaining inline patterns in templates.ts (which already imported the helper but wasn't using it everywhere)
  • This is a continuation of the tech-debt effort from PR Extract duplicate constraint-error handler in personalities.ts #602 which adopted errorMessage() in personalities.ts

Why this is tech debt

The shared errorMessage() helper was introduced specifically to eliminate this boilerplate. These 7 remaining inline instances were the last holdouts — using them inconsistently defeats the purpose of the shared helper and makes future changes (e.g., adding logging or changing the fallback behavior) require touching every file instead of one.

What's next

Next tech-debt run will tackle the top backlog item: monitoring the ide-settings.ts / agent-type-settings.ts pattern similarity.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@selfcontained
selfcontained merged commit a6b22f1 into main May 27, 2026
1 check passed
@selfcontained
selfcontained deleted the tech-debt/adopt-error-message-helper branch May 27, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant