MCPcopy Create free account
hub / github.com/PABannier/bark.cpp / exception_message

Method exception_message

examples/server/json.hpp:11988–12022  ·  view source on GitHub ↗

! @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 */

Source from the content-addressed store, hash-verified

11986 @return a message string to use in the parse_error exceptions
11987 */
11988 std::string exception_message(const input_format_t format,
11989 const std::string& detail,
11990 const std::string& context) const
11991 {
11992 std::string error_msg = "syntax error while parsing ";
11993
11994 switch (format)
11995 {
11996 case input_format_t::cbor:
11997 error_msg += "CBOR";
11998 break;
11999
12000 case input_format_t::msgpack:
12001 error_msg += "MessagePack";
12002 break;
12003
12004 case input_format_t::ubjson:
12005 error_msg += "UBJSON";
12006 break;
12007
12008 case input_format_t::bson:
12009 error_msg += "BSON";
12010 break;
12011
12012 case input_format_t::bjdata:
12013 error_msg += "BJData";
12014 break;
12015
12016 case input_format_t::json: // LCOV_EXCL_LINE
12017 default: // LCOV_EXCL_LINE
12018 JSON_ASSERT(false); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert) LCOV_EXCL_LINE
12019 }
12020
12021 return concat(error_msg, ' ', context, ": ", detail);
12022 }
12023
12024 private:
12025 static JSON_INLINE_VARIABLE constexpr std::size_t npos = static_cast<std::size_t>(-1);

Callers

nothing calls this directly

Calls 1

concatFunction · 0.85

Tested by

no test coverage detected