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

[NFC] Provide exception overloads without context #3375

Conversation

falbrechtskirchinger
Copy link
Contributor

Currently the static create() member functions of exceptions require a const BasicJsonType &context parameter. This PR adds overloads without a context parameter and replaces uses of JSON_THROW(exception_type::create(..., BasicJsonType())) and similar with the context-less version.

This removes one obstacle to freeing json_pointer from its class template parameter in the future.

Provide overloads for static exception create() member functions without
const BasicJsonType &context parameter.
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.05%) to 99.946% when pulling 698ccc4 on falbrechtskirchinger:exceptions-no-context into e4643d1 on nlohmann:develop.

@gregmarr
Copy link
Contributor

gregmarr commented Mar 9, 2022

I'm not wild about the duplication, and this makes it easier to forget to see if there is an appropriate context parameter available. What about changing it from a reference to a pointer so that the callers that don't have one can just pass nullptr?

@falbrechtskirchinger
Copy link
Contributor Author

Fair enough. I don't like the duplication either. This is a low-priority item and I'll get to it eventually.

@falbrechtskirchinger
Copy link
Contributor Author

This has been folded into #3415 with changes requested.

@falbrechtskirchinger falbrechtskirchinger deleted the exceptions-no-context branch April 4, 2022 04:52
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.

3 participants