feat!: show detailed validation errors in error.cause #6551
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
BREAKING:
ValidationError
now requires theglobal
orcollection
slug, as well as anerrors
property. The actual errors are no longer at the top-level.Now:
![CleanShot 2024-05-29 at 11 59 12](https://private-user-images.githubusercontent.com/70709113/334875289-7d5ac5ff-c88e-40bb-9c31-1e3cab8405da.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM3NjU5MjEsIm5iZiI6MTcyMzc2NTYyMSwicGF0aCI6Ii83MDcwOTExMy8zMzQ4NzUyODktN2Q1YWM1ZmYtYzg4ZS00MGJiLTljMzEtMWUzY2FiODQwNWRhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE1VDIzNDcwMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdkOWZhYTMxODhlMTZiNTRkMTRkNTNiOGQ1N2JjMGRlZmFhMDVhMWZlZjIzZDA1NzI0Yzk5MTVjYTI4MWIxN2ImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.rLRU-k6CN70zfl7qbZY5bJMAw-E9r5PxDgmL6cLn66E)
Previously, we would have no way to know what the error message was, or in which collection that field resides in
TODO: Include error.cause for pino-logged errors as well, see pinojs/pino-pretty#518