Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enhance discriminated union error reporting #3784

Closed

Conversation

Doryski
Copy link

@Doryski Doryski commented Oct 4, 2024

Motivation

When working with discriminated unions, it's crucial to have clear and informative error messages when validation fails. The current implementation lacks some important details that can help developers quickly identify and fix issues.

Changes

  1. Added the received value to the error message:
    This allows developers to see exactly what value was provided for the discriminator, making it easier to debug issues where the wrong value is being sent.

  2. Modified the error path:
    The new path includes information about the union option, providing more context about where in the schema structure the error occurred.

  3. Updated relevant tests:
    The test suite has been updated to reflect these changes and ensure that the new error format is working as expected.

  4. Fixed type errors:
    All type-related issues have been addressed to maintain type safety and consistency.

Copy link

netlify bot commented Oct 4, 2024

Deploy Preview for guileless-rolypoly-866f8a ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 9078140
🔍 Latest deploy log https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/67000ae9cee7220008512864
😎 Deploy Preview https://deploy-preview-3784--guileless-rolypoly-866f8a.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Doryski Doryski closed this by deleting the head repository Oct 4, 2024
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