Skip to content

Add missing domain error types to REST API error handling middleware#65

Closed
Copilot wants to merge 2 commits into
neverthrowfrom
copilot/sub-pr-62-again
Closed

Add missing domain error types to REST API error handling middleware#65
Copilot wants to merge 2 commits into
neverthrowfrom
copilot/sub-pr-62-again

Conversation

Copilot AI commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

The REST API error handling middleware was missing several domain error types that were already properly handled by the oRPC layer. This caused these errors to be treated as generic 500 errors instead of their correct HTTP status codes when thrown from REST endpoints.

Changes

  • Imports: Added ScoreTypeMismatchError and TooManyParticipantsError
  • HeatDomainError union: Added ScoreNotFoundError and ScoreTypeMismatchError
  • isHeatDomainError guard: Added instanceof checks for the new heat error types
  • BracketDomainError union: Added TooManyParticipantsError
  • isBracketDomainError guard: Added instanceof check for the new bracket error type

Impact

Errors are now correctly mapped to HTTP status codes:

  • ScoreNotFoundError → 404 (was 500)
  • ScoreTypeMismatchError → 400 (was 500)
  • TooManyParticipantsError → 400 (was 500)

REST API error handling now matches oRPC error behavior.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix issues in refactoring to use neverthrow Result types Add missing domain error types to REST API error handling middleware Feb 3, 2026
Copilot AI requested a review from danbim February 3, 2026 09:45
@danbim danbim closed this 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