23 using jubatus::util::text::json::json;
28 namespace jsonconfig {
32 message_(message +
" (" + path_ +
")") {
40 const char* TypeToName(json::json_type_t t) {
57 return "Unknown Type";
61 std::string MakeTypeErrorMessage(
62 json::json_type_t expect,
63 json::json_type_t actual) {
64 return string(TypeToName(expect)) +
" is expected, but " + TypeToName(actual)
68 std::string MakeOutOfRangeMessage(
size_t size,
size_t index) {
69 std::ostringstream os;
70 os <<
"Out of range 0.." << size <<
": " << index;
74 std::string MakeNotFoundMessage(
const std::string& key) {
75 return "\"" + key +
"\" is not found";
78 std::string MakeRedundantKeyMessage(
const std::string& key) {
79 return "\"" + key +
"\" is not used";
85 const std::string& path,
86 json::json_type_t expect,
87 json::json_type_t actual)
88 :
config_error(path, MakeTypeErrorMessage(expect, actual)),
97 :
config_error(path, MakeOutOfRangeMessage(size, index)),
122 const std::vector<jubatus::util::lang::shared_ptr<config_error> >& errors)
123 : errors_(errors.begin(), errors.end()) {
out_of_range(const std::string &path, size_t size, size_t index)
redundant_key(const std::string &path, const std::string &key)
type_error(const std::string &path, jubatus::util::text::json::json::json_type_t expect, jubatus::util::text::json::json::json_type_t actual)
not_found(const std::string &path, const std::string &key)
cast_check_error(const std::vector< jubatus::util::lang::shared_ptr< config_error > > &errors)
config_error(const std::string &path, const std::string &message)