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

Potentially show new errInfo data in validation errors #15

Closed
atlantis opened this issue Oct 7, 2022 · 2 comments
Closed

Potentially show new errInfo data in validation errors #15

atlantis opened this issue Oct 7, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@atlantis
Copy link

atlantis commented Oct 7, 2022

Not sure exactly how you'd want to implement this, but the new specific validation errors Mongo 5 gives are super helpful, so for my own use I've just added:

#Patch cryomongo /lib/cryomongo/src/cryomongo/error.cr : 164
if info = error["errInfo"]?.as?(BSON)
puts "Mongo errInfo: \n" + info.to_json
end

The errInfo is deeply nested an unpredictable, so to add it officially to the library should the Error perhaps have property info : BSON??

@elbywan
Copy link
Owner

elbywan commented Oct 8, 2022

Hey @atlantis 👋

the new specific validation errors Mongo 5 gives are super helpful

True, thanks for pointing this out!

The errInfo is deeply nested an unpredictable, so to add it officially to the library should the Error perhaps have property info : BSON

I added a @details getter populated by the errInfo field in this commit: 9f77126 and released v0.3.11 which includes the change.

@elbywan elbywan added the enhancement New feature or request label Oct 8, 2022
@atlantis
Copy link
Author

atlantis commented Oct 8, 2022 via email

@elbywan elbywan closed this as completed Oct 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants