generated from Sithas/conan_template
мелкие правки
This commit is contained in:
@@ -10,9 +10,7 @@
|
||||
#include "../DAO/IUserDAO.h"
|
||||
#include "../DAO/IAuthDAO.h"
|
||||
#include "./../helpers/helpers.h"
|
||||
#include "./../exceptions/exception400_bad_request.h"
|
||||
#include "./../exceptions/exception409_conflict.h"
|
||||
#include "./../exceptions/exception422_unprocessable_entity.h"
|
||||
#include "./../exceptions/session_exception.h"
|
||||
|
||||
namespace uad
|
||||
{
|
||||
@@ -96,37 +94,9 @@ public:
|
||||
|
||||
return send(std::move(res));
|
||||
}
|
||||
catch (const exception400_bad_request& e)
|
||||
catch (const session_exception& e)
|
||||
{
|
||||
boost::beast::http::response<ResponseType> res{boost::beast::http::status::bad_request, 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 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::beast::http::response<ResponseType> res{e.code, req.version()};
|
||||
boost::json::value response_body;
|
||||
|
||||
response_body.emplace_object();
|
||||
|
||||
Reference in New Issue
Block a user