mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-17 00:22:14 +11:00
changed error status
This commit is contained in:
parent
749d20880f
commit
b64e562235
2 changed files with 9 additions and 9 deletions
|
|
@ -1,10 +1,10 @@
|
|||
#pragma once
|
||||
enum ErrorResponse
|
||||
{
|
||||
UserNotFound = -1,
|
||||
WrongPassword = -2,
|
||||
InvalidRequest = -3,
|
||||
NameTooLong = -4,
|
||||
UserAlreadyExists = -5,
|
||||
InsufficientFunds = -6,
|
||||
UserNotFound = -1, //404
|
||||
WrongPassword = -2, //401
|
||||
InvalidRequest = -3, //400
|
||||
NameTooLong = -4, //400?
|
||||
UserAlreadyExists = -5, //409
|
||||
InsufficientFunds = -6, //402?
|
||||
};
|
||||
|
|
@ -81,7 +81,7 @@ BankResponse Bank::SendFunds(const std::string &a_name, const std::string &b_nam
|
|||
//if A can afford it
|
||||
if (a.balance < amount)
|
||||
{
|
||||
state = {k204NoContent, "Sender has insufficient funds"};
|
||||
state = {k402PaymentRequired, "Sender has insufficient funds"};
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -104,10 +104,10 @@ BankResponse Bank::SendFunds(const std::string &a_name, const std::string &b_nam
|
|||
{
|
||||
std::shared_lock<std::shared_mutex> lock{send_funds_l};
|
||||
users.modify_if(a_name, [this, &state, amount](User &a) {
|
||||
//if A can afford it and A's password matches attempt
|
||||
//if A can afford it
|
||||
if (a.balance < amount)
|
||||
{
|
||||
state = {k204NoContent, "Sender has insufficient funds"};
|
||||
state = {k402PaymentRequired, "Sender has insufficient funds"};
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue