🔥 reverted noexcept as drogon doesnt like it

This commit is contained in:
EntireTwix 2021-07-03 17:48:11 -07:00
parent 5c1a9264d3
commit f04ca463fe
2 changed files with 18 additions and 18 deletions

View file

@ -14,21 +14,21 @@ class api : public HttpController<api, false>
public: public:
api(Bank &b) noexcept; api(Bank &b) noexcept;
#if API_VERSION >= 1 #if API_VERSION >= 1
void GetBal(req_args, const std::string &name) const noexcept; void GetBal(req_args, const std::string &name) const;
void GetLog(req_args) const noexcept; void GetLog(req_args);
void SendFunds(req_args) const; void SendFunds(req_args) const;
void VerifyPassword(req_args) const noexcept; void VerifyPassword(req_args) const;
void ChangePassword(req_args) const; void ChangePassword(req_args) const;
void AdminChangePassword(req_args) const; void AdminChangePassword(req_args) const;
void SetBal(req_args) const; void SetBal(req_args) const;
void Help(req_args) const noexcept; void Help(req_args) const;
void Ping(req_args) const noexcept; void Ping(req_args) const;
void Close(req_args) const noexcept; void Close(req_args) const;
void Contains(req_args, const std::string &name) const noexcept; void Contains(req_args, const std::string &name) const;
void AdminVerifyAccount(req_args) noexcept; void AdminVerifyAccount(req_args) const;
void ApiVersion(req_args) const noexcept; void ApiVersion(req_args) const;
void AddUser(req_args) const; void AddUser(req_args) const;
void AdminAddUser(req_args) const; void AdminAddUser(req_args) const;

View file

@ -49,11 +49,11 @@ api::api(Bank &b) noexcept : bank(b) {}
#if API_VERSION >= 1 #if API_VERSION >= 1
//Usage //Usage
void api::GetBal(req_args, const std::string &name) const noexcept void api::GetBal(req_args, const std::string &name) const
{ {
RESPONSE_PARSE(bank.GetBal(name)); RESPONSE_PARSE(bank.GetBal(name));
} }
void api::GetLog(req_args) noexcept void api::GetLog(req_args)
{ {
if constexpr (MAX_LOG_SIZE > 0) if constexpr (MAX_LOG_SIZE > 0)
{ {
@ -73,7 +73,7 @@ void api::SendFunds(req_args) const
GEN_BODY GEN_BODY
RESPONSE_PARSE(bank.SendFunds(NAME_PARAM, body["to"].asCString(), body["amount"].asUInt())); RESPONSE_PARSE(bank.SendFunds(NAME_PARAM, body["to"].asCString(), body["amount"].asUInt()));
} }
void api::VerifyPassword(req_args) const noexcept { RESPOND_TRUE } void api::VerifyPassword(req_args) const { RESPOND_TRUE }
//Meta Usage //Meta Usage
void api::ChangePassword(req_args) const void api::ChangePassword(req_args) const
@ -95,7 +95,7 @@ void api::SetBal(req_args) const
} }
//System Usage //System Usage
void api::Help(req_args) const noexcept void api::Help(req_args) const
{ {
auto resp = HttpResponse::newHttpResponse(); auto resp = HttpResponse::newHttpResponse();
resp->setBody(""); //will be filled in with docs resp->setBody(""); //will be filled in with docs
@ -103,7 +103,7 @@ void api::Help(req_args) const noexcept
CACHE_FOREVER; CACHE_FOREVER;
callback(resp); callback(resp);
} }
void api::Ping(req_args) const noexcept void api::Ping(req_args) const
{ {
auto resp = HttpResponse::newHttpResponse(); auto resp = HttpResponse::newHttpResponse();
resp->setBody("pong"); resp->setBody("pong");
@ -111,24 +111,24 @@ void api::Ping(req_args) const noexcept
CACHE_FOREVER; CACHE_FOREVER;
callback(resp); callback(resp);
} }
void api::Close(req_args) const noexcept void api::Close(req_args) const
{ {
bank.Save(); bank.Save();
app().quit(); app().quit();
RESPOND_TRUE //filter handles admin creds RESPOND_TRUE //filter handles admin creds
} }
void api::Contains(req_args, const std::string &name) const noexcept void api::Contains(req_args, const std::string &name) const
{ {
auto resp = HttpResponse::newHttpJsonResponse(JsonCast(bank.Contains(name))); auto resp = HttpResponse::newHttpJsonResponse(JsonCast(bank.Contains(name)));
resp->setStatusCode(k200OK); resp->setStatusCode(k200OK);
CORS; CORS;
callback(resp); callback(resp);
} }
void api::AdminVerifyAccount(req_args) const noexcept void api::AdminVerifyAccount(req_args) const
{ {
RESPOND_TRUE //filter handles admin creds RESPOND_TRUE //filter handles admin creds
} }
void api::ApiVersion(req_args) const noexcept void api::ApiVersion(req_args) const
{ {
auto resp = HttpResponse::newHttpJsonResponse(API_VERSION); auto resp = HttpResponse::newHttpJsonResponse(API_VERSION);
resp->setStatusCode(k200OK); resp->setStatusCode(k200OK);