MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / ErrorRenderer

Class ErrorRenderer

include/engine/plugins/plugin_base.hpp:68–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66 }
67
68 struct ErrorRenderer
69 {
70 std::string code;
71 std::string message;
72
73 ErrorRenderer(std::string code, std::string message)
74 : code(std::move(code)), message(std::move(message)){};
75
76 void operator()(util::json::Object &json_result)
77 {
78 json_result.values["code"] = code;
79 json_result.values["message"] = message;
80 };
81 void operator()(flatbuffers::FlatBufferBuilder &fb_result)
82 {
83 auto error = api::fbresult::CreateErrorDirect(fb_result, code.c_str(), message.c_str());
84 api::fbresult::FBResultBuilder response(fb_result);
85 response.add_error(true);
86 response.add_code(error);
87 fb_result.Finish(response.Finish());
88 };
89 void operator()(std::string &str_result)
90 {
91 str_result = std::format("code={} message={}", code, message);
92 };
93 };
94
95 Status Error(const std::string &code,
96 const std::string &message,

Callers 1

ErrorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected