MCPcopy Create free account
hub / github.com/pboettch/json-schema-validator / custom_error_handler

Class custom_error_handler

example/readme.cpp:77–84  ·  view source on GitHub ↗

json-parse the people - with custom error handler */

Source from the content-addressed store, hash-verified

75
76 /* json-parse the people - with custom error handler */
77 class custom_error_handler : public nlohmann::json_schema::basic_error_handler
78 {
79 void error(const nlohmann::json::json_pointer &ptr, const json &instance, const std::string &message) override
80 {
81 nlohmann::json_schema::basic_error_handler::error(ptr, instance, message);
82 std::cerr << "ERROR: '" << ptr << "' - '" << instance << "': " << message << "\n";
83 }
84 };
85
86 for (auto &person : {bad_person, good_person}) {
87 std::cout << "About to validate this person:\n"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected