-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
explicitly specify error set of std.json.stringify
#16323
Conversation
fbf2e19
to
4f17351
Compare
#2971 is solved already, it just needs test coverage in order to be closed. |
This PR reverts a feature implemented explicitly by #15172 , but there was no link to a use case in that original PR, so it's hard to tell the impact of removing it. Can @mateusz834 weigh in on why custom errors from |
I've had a custom stringifier, that required an allocator, and it was annoying that it worked fine while writing to ArrayList.Writer(), but not to other writers that didn't return the OutOfMemory. |
@Techatrix do you think there's a way to use some kind of generic programming to enable both use cases? It seems a little tacky to throw Or @mateusz834 is this no longer a required use case? Would it break anything to drop support for the original feature? |
Coincidentally this is exactly what I was looking into right now. The tres library uses a generic function to resolve the error set of its json parse function that could also work for stringify. |
It is fine to break this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is fine to break this.
In that case, I don't think we need to over-complicate this. 🤷 This PR seems good as-is.
fixes #15859
This change wouldn't be necessary if #2971 was implemented, but until that happens, this will make using
std.json.stringify
on recursive structures easier to deal with.