Skip to content

Add missing error type coverage in domain error type guards#64

Merged
danbim merged 2 commits intoneverthrowfrom
copilot/sub-pr-62
Feb 4, 2026
Merged

Add missing error type coverage in domain error type guards#64
danbim merged 2 commits intoneverthrowfrom
copilot/sub-pr-62

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

The error handling middleware's type guards were incomplete, missing ScoreTypeMismatchError, ScoreNotFoundError, and TooManyParticipantsError despite these errors being returned by domain services.

Changes

Type definitions and guards (src/api/middleware/error-handling.ts):

  • Added ScoreTypeMismatchError and ScoreNotFoundError to HeatDomainError union
  • Added TooManyParticipantsError to BracketDomainError union
  • Updated isHeatDomainError() to check for both new error types
  • Updated isBracketDomainError() to check for TooManyParticipantsError

Test coverage (__tests__/api/middleware/error-handling.test.ts):

  • Verified ScoreNotFoundError is recognized by isHeatDomainError and maps to 404
  • Verified ScoreTypeMismatchError is recognized by isHeatDomainError and maps to 400
  • Verified TooManyParticipantsError is recognized by isBracketDomainError and maps to 400

All error types now have complete type guard coverage and correct HTTP status code mappings.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…yParticipantsError

Co-authored-by: danbim <300638+danbim@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on refactoring error handling Add missing error type coverage in domain error type guards Feb 3, 2026
Copilot AI requested a review from danbim February 3, 2026 09:51
@danbim danbim marked this pull request as ready for review February 4, 2026 08:39
@danbim danbim merged commit 225248b into neverthrow Feb 4, 2026
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.

2 participants