diff --git a/lib/json/errorhandling.h b/lib/json/errorhandling.h index fb34ab5..d363950 100644 --- a/lib/json/errorhandling.h +++ b/lib/json/errorhandling.h @@ -155,6 +155,7 @@ struct JsonDeserializationErrors : public std::vector JsonDeserializationErrors(); template void reportTypeMismatch(RAPIDJSON_NAMESPACE::Type presentType); + template void reportTypeMismatch(RAPIDJSON_NAMESPACE::Type presentType); void reportArraySizeMismatch(); void reportConversionError(JsonType jsonType); void reportUnexpectedDuplicate(JsonType jsonType); @@ -220,6 +221,16 @@ template inline void JsonDeserializationErrors::reportTy throwMaybe(ThrowOn::TypeMismatch); } +/*! + * \brief Reports a type mismatch between \tparam expectedType and \a presentType within the current context. + */ +template inline void JsonDeserializationErrors::reportTypeMismatch(RAPIDJSON_NAMESPACE::Type presentType) +{ + emplace_back( + JsonDeserializationErrorKind::TypeMismatch, jsonType(expectedType), jsonType(presentType), currentRecord, currentMember, currentIndex); + throwMaybe(ThrowOn::TypeMismatch); +} + /*! * \brief Reports an array size mismatch. * \todo Allow specifying expected and actual size.