Skip to content

Commit

Permalink
Improve error messages for error 305
Browse files Browse the repository at this point in the history
Addresses nlohmann#1220
  • Loading branch information
rivertam committed Aug 30, 2018
1 parent d713727 commit bbdfe7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3097,7 +3097,7 @@ class basic_json
return m_value.array->operator[](idx);
}

JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name())));
JSON_THROW(type_error::create(305, "cannot use operator[] with a numeric argument with " + std::string(type_name())));
}

/*!
Expand Down Expand Up @@ -3127,7 +3127,7 @@ class basic_json
return m_value.array->operator[](idx);
}

JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name())));
JSON_THROW(type_error::create(305, "cannot use operator[] with a numeric argument with " + std::string(type_name())));
}

/*!
Expand Down Expand Up @@ -3173,7 +3173,7 @@ class basic_json
return m_value.object->operator[](key);
}

JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name())));
JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name())));
}

/*!
Expand Down Expand Up @@ -3215,7 +3215,7 @@ class basic_json
return m_value.object->find(key)->second;
}

JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name())));
JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name())));
}

/*!
Expand Down Expand Up @@ -3262,7 +3262,7 @@ class basic_json
return m_value.object->operator[](key);
}

JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name())));
JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name())));
}

/*!
Expand Down Expand Up @@ -3305,7 +3305,7 @@ class basic_json
return m_value.object->find(key)->second;
}

JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name())));
JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name())));
}

/*!
Expand Down
12 changes: 6 additions & 6 deletions single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14204,7 +14204,7 @@ class basic_json
return m_value.array->operator[](idx);
}

JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name())));
JSON_THROW(type_error::create(305, "cannot use operator[] with a numeric argument with " + std::string(type_name())));
}

/*!
Expand Down Expand Up @@ -14234,7 +14234,7 @@ class basic_json
return m_value.array->operator[](idx);
}

JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name())));
JSON_THROW(type_error::create(305, "cannot use operator[] with a numeric argument with " + std::string(type_name())));
}

/*!
Expand Down Expand Up @@ -14280,7 +14280,7 @@ class basic_json
return m_value.object->operator[](key);
}

JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name())));
JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name())));
}

/*!
Expand Down Expand Up @@ -14322,7 +14322,7 @@ class basic_json
return m_value.object->find(key)->second;
}

JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name())));
JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name())));
}

/*!
Expand Down Expand Up @@ -14369,7 +14369,7 @@ class basic_json
return m_value.object->operator[](key);
}

JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name())));
JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name())));
}

/*!
Expand Down Expand Up @@ -14412,7 +14412,7 @@ class basic_json
return m_value.object->find(key)->second;
}

JSON_THROW(type_error::create(305, "cannot use operator[] with " + std::string(type_name())));
JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name())));
}

/*!
Expand Down

0 comments on commit bbdfe7d

Please sign in to comment.