Skip to content

Conversation

@kettanaito
Copy link
Member

@kettanaito kettanaito commented Oct 2, 2025

  • Closes Describe approach of error handling #307
  • Documents error handling in README.md.
  • Implements a RelationError class.
  • Refactors the OperationError to include code instead of specific operation names.
  • Validates unique relations for the lack of other owners referencing the same foreign record(s) (for one-way unique relations).
  • Adds missing tests for unique relations.

Todos

  • Use code for OperationError instead of .operationName. Make it an enum.
  • Change the tests to assert the right errors are being thrown.
  • Add unique many-to relation tests.
    • one-to-many unique relations tests are present. The many-to relations cannot be unique by design; they implied that many records may reference many other records.

@kettanaito kettanaito marked this pull request as ready for review October 2, 2025 14:57
@kettanaito kettanaito marked this pull request as draft October 2, 2025 14:59
@kettanaito kettanaito marked this pull request as ready for review October 2, 2025 15:24
@kettanaito kettanaito force-pushed the fix/relation-errors branch from d6a0137 to 64739e6 Compare October 2, 2025 17:21
@kettanaito kettanaito force-pushed the fix/relation-errors branch from 64739e6 to 6ac646a Compare October 2, 2025 17:24
@kettanaito kettanaito force-pushed the fix/relation-errors branch from 7537320 to ba28287 Compare October 3, 2025 09:11
@kettanaito kettanaito changed the title fix: implement RelationError, document error handling fix: implement RelationError, improve unique relations validation Oct 3, 2025
@kettanaito kettanaito merged commit 61a1d5f into main Oct 3, 2025
1 check passed
@kettanaito kettanaito deleted the fix/relation-errors branch October 3, 2025 09:14
@kettanaito
Copy link
Member Author

Released: v1.0.1 🎉

This has been released in v1.0.1.

Get these changes by running the following command:

npm i @msw/data@latest

Predictable release automation by Release.

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.

Describe approach of error handling

2 participants