generated from Sithas/conan_template
Registration переведен на систему исключений вместо возврата
This commit is contained in:
@@ -108,6 +108,34 @@ public:
|
||||
res.set(boost::beast::http::field::content_type, "application/json");
|
||||
res.content_length(res.body().size());
|
||||
|
||||
return send(std::move(res));
|
||||
}
|
||||
catch (const exception409_conflict& e)
|
||||
{
|
||||
boost::beast::http::response<ResponseType> res{boost::beast::http::status::conflict, req.version()};
|
||||
boost::json::value response_body;
|
||||
|
||||
response_body.emplace_object();
|
||||
response_body.as_object().emplace("Result", e.what());
|
||||
|
||||
res.body() = serialize(response_body);
|
||||
res.set(boost::beast::http::field::content_type, "application/json");
|
||||
res.content_length(res.body().size());
|
||||
|
||||
return send(std::move(res));
|
||||
}
|
||||
catch (const exception422_unprocessable_entity& e)
|
||||
{
|
||||
boost::beast::http::response<ResponseType> res{boost::beast::http::status::unprocessable_entity, req.version()};
|
||||
boost::json::value response_body;
|
||||
|
||||
response_body.emplace_object();
|
||||
response_body.as_object().emplace("Result", e.what());
|
||||
|
||||
res.body() = serialize(response_body);
|
||||
res.set(boost::beast::http::field::content_type, "application/json");
|
||||
res.content_length(res.body().size());
|
||||
|
||||
return send(std::move(res));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user