Can you tell me what's wrong with my code? #2294
-
The json file is attached. I have no idea why it always print nothing. As you can see, I inserted the code to print |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
std::cout<< glz::format_error(foo, json) << std::endl;You can also use If you use either of those approaches you'll get an error back. |
Beta Was this translation helpful? Give feedback.
custom_error_messageis typically empty, unless you implement some special custom error handling. Instead, you should have an else on yourif (!foo)check and useglz::format_errorto nicely format the error:You can also use
glz::ex::read_jsonif you would prefer exceptions to be thrown on errors.If you use either of those approaches you'll get an error back.