generated from Sithas/conan_template
Добавлены структуры исключений
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "IExecutor.h"
|
||||
#include "../DAO/IUserDAO.h"
|
||||
#include "../exceptions/exception400_bad_request.h"
|
||||
|
||||
namespace uad
|
||||
{
|
||||
@@ -37,24 +38,17 @@ public:
|
||||
value req_json;
|
||||
value response_body;
|
||||
|
||||
response_body.emplace_object();
|
||||
|
||||
try
|
||||
{
|
||||
req_json = json::parse(body);
|
||||
}
|
||||
catch (const system::system_error& err)
|
||||
{
|
||||
http::response<ResponseType> res{http::status::bad_request, req.version()};
|
||||
response_body.as_object().emplace("Result", "cannot deserialize json");
|
||||
|
||||
res.body() = serialize(response_body);
|
||||
res.set(http::field::content_type, "application/json");
|
||||
res.content_length(res.body().size());
|
||||
|
||||
return res;
|
||||
throw exception400_bad_request("cannot deserialize json");
|
||||
}
|
||||
|
||||
response_body.emplace_object();
|
||||
|
||||
const std::string login = req_json.as_object().at("login").as_string().c_str();
|
||||
const std::string password = req_json.as_object().at("password").as_string().c_str();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user