! @param[in] format the current format @param[in] detail a detailed error message @param[in] context further context information @return a message string to use in the parse_error exceptions */
| 12060 | @return a message string to use in the parse_error exceptions |
| 12061 | */ |
| 12062 | std::string exception_message(const input_format_t format, |
| 12063 | const std::string& detail, |
| 12064 | const std::string& context) const |
| 12065 | { |
| 12066 | std::string error_msg = "syntax error while parsing "; |
| 12067 | |
| 12068 | switch (format) |
| 12069 | { |
| 12070 | case input_format_t::cbor: |
| 12071 | error_msg += "CBOR"; |
| 12072 | break; |
| 12073 | |
| 12074 | case input_format_t::msgpack: |
| 12075 | error_msg += "MessagePack"; |
| 12076 | break; |
| 12077 | |
| 12078 | case input_format_t::ubjson: |
| 12079 | error_msg += "UBJSON"; |
| 12080 | break; |
| 12081 | |
| 12082 | case input_format_t::bson: |
| 12083 | error_msg += "BSON"; |
| 12084 | break; |
| 12085 | |
| 12086 | case input_format_t::bjdata: |
| 12087 | error_msg += "BJData"; |
| 12088 | break; |
| 12089 | |
| 12090 | case input_format_t::json: // LCOV_EXCL_LINE |
| 12091 | default: // LCOV_EXCL_LINE |
| 12092 | JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE |
| 12093 | } |
| 12094 | |
| 12095 | return concat(error_msg, ' ', context, ": ", detail); |
| 12096 | } |
| 12097 | |
| 12098 | private: |
| 12099 | static JSON_INLINE_VARIABLE constexpr std::size_t npos = static_cast<std::size_t>(-1); |