Fix non-compilable code example in README.md
This commit is contained in:
parent
1688c54a6e
commit
e14d2896ff
@ -112,6 +112,7 @@ See also `app/json-schema-validate.cpp`.
|
|||||||
|
|
||||||
```C++
|
```C++
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
#include "json-schema.hpp"
|
#include "json-schema.hpp"
|
||||||
|
|
||||||
@ -177,10 +178,11 @@ int main()
|
|||||||
/* json-parse the people - with custom error handler */
|
/* json-parse the people - with custom error handler */
|
||||||
class custom_error_handler : public nlohmann::json_schema::basic_error_handler
|
class custom_error_handler : public nlohmann::json_schema::basic_error_handler
|
||||||
{
|
{
|
||||||
void error(const std::string &path, const json &instance, const std::string &message) override
|
void error(const nlohmann::json_pointer<nlohmann::basic_json<>> &pointer, const json &instance,
|
||||||
|
const std::string &message) override
|
||||||
{
|
{
|
||||||
nlohmann::json_schema::basic_error_handler::error(path, instance, message);
|
nlohmann::json_schema::basic_error_handler::error(pointer, instance, message);
|
||||||
std::cerr << "ERROR: '" << path << "' - '" << instance << "': " << message << "\n";
|
std::cerr << "ERROR: '" << pointer << "' - '" << instance << "': " << message << "\n";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user