-
Notifications
You must be signed in to change notification settings - Fork 145
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
provide additional option to use custom error handler for set_root_schema #187
Comments
You mean, instead of the thrown exceptions in case of errors? Are there that many errors thrown when setting the root schema? |
Providing a schema via argument / startup of the application provided by the user those erros will occure. I agree that those errors do not occure as often, but they will occure and providing precise information via error_handler will help fix those. Also I am planning to integrate this schema validator in an embedded environment which will have exceptions turned off. |
I see your point, but I'm unsure which kind of finer graded error-messages this would provide by just having a callback called instead of an exception. The schema is so free in what can be done with it. There is no schema-syntax check when setting the root-schema, wrong fields will silently be ignored (and maybe treated as unknown keywords). |
That is great, but I ran into the issue when I referenced to an non existent ref. object. Aka, it throws in case of |
What would you think if dedicated exceptions would be thrown for the errors? I'd prefer actually. |
And the exception would be extended with a json pointer containing location of the bad reference and the bad reference? That would work. |
I know this is possible in Python, but is this doable in C++? Customizing exceptions arguments? I'd be happy to have a look if you'd have some time to try out something that fits your needs. Also see this issue, which would be then related: |
Well, I am not the biggest expert, but as I would do it is extend |
Sounds good. What would be a estimated time of arrival if you could get your hands on it? |
Hi, It would be very usefull to be able to turn off exceptions for when they are not supported: Otherwise any issues parsing a root schema will throw an exception. Thanks |
Would it be possible to extend the
json_validator::set_root_schema(json &&schema)
function to allow also a custom error handler likejson_validator::validate(...)
has?This would allow me to provide a more precise and user custom error than the exception provides. I am happy to provide a MR if this feature is welcome. I propose following extension:
I am also open for alternatives.
Cheers
The text was updated successfully, but these errors were encountered: