submit_raw_tx error code added

new_rpc
moneroexamples 5 years ago
parent 77bca3a467
commit cf3d51533c

@ -48,7 +48,7 @@ class HostedMoneroAPIClient
).catch(
function(data)
{
fn(data && data.Error ? data.Error : "Something went wrong with getting your available balance for spending");
fn(data && data.data.Error ? data.data.Error : "Something went wrong with getting your available balance for spending");
}
);
const requestHandle =
@ -72,7 +72,7 @@ class HostedMoneroAPIClient
).catch(
function(data)
{
fn(data && data.Error ? data.Error : "Something went wrong while getting decoy outputs");
fn(data && data.data.Error ? data.data.Error : "Something went wrong while getting decoy outputs");
}
);
const requestHandle =
@ -96,7 +96,7 @@ class HostedMoneroAPIClient
).catch(
function(data)
{
fn(data && data.Error ? data.Error : "Something went wrong while submitting your transaction");
fn(data && data.data.Error ? data.data.Error : "Something went wrong while submitting your transaction");
}
);
const requestHandle =

@ -918,11 +918,12 @@ YourMoneroRequests::submit_raw_tx(
if(!epee::string_tools::parse_hexstr_to_binbuff(raw_tx_blob, tx_blob))
{
j_response["status"] = "error";
j_response["error"] = "Tx faild parse_hexstr_to_binbuff";
j_response["Error"] = "Tx faild parse_hexstr_to_binbuff";
OMERROR << j_response["error"];
OMERROR << j_response["Error"];
session_close(session, j_response.dump());
session_close(session, j_response.dump(),
INTERNAL_SERVER_ERROR);
return;
}
@ -931,25 +932,27 @@ YourMoneroRequests::submit_raw_tx(
if (!parse_and_validate_tx_from_blob(tx_blob, tx_to_be_submitted))
{
j_response["status"] = "error";
j_response["error"] = "Tx faild parse_and_validate_tx_from_blob";
j_response["Error"] = "Tx faild parse_and_validate_tx_from_blob";
OMERROR << j_response["error"];
OMERROR << j_response["Error"];
session_close(session, j_response.dump());
session_close(session, j_response.dump(),
INTERNAL_SERVER_ERROR);
return;
}
if (current_bc_status->find_key_images_in_mempool(tx_to_be_submitted))
{
j_response["status"] = "error";
j_response["error"] = "Tx uses your outputs that area already "
j_response["Error"] = "Tx uses your outputs that area already "
"in the mempool. "
"Please wait till your previous tx(s) "
"get mined";
OMERROR << j_response["error"];
OMERROR << j_response["Error"];
session_close(session, j_response.dump());
session_close(session, j_response.dump(),
INTERNAL_SERVER_ERROR);
return;
}
@ -958,11 +961,12 @@ YourMoneroRequests::submit_raw_tx(
current_bc_status->get_bc_setup().do_not_relay))
{
j_response["status"] = "error";
j_response["error"] = error_msg;
j_response["Error"] = error_msg;
OMERROR << j_response["error"];
OMERROR << j_response["Error"];
session_close(session, j_response.dump());
session_close(session, j_response.dump(),
INTERNAL_SERVER_ERROR);
return;
}
@ -1923,11 +1927,13 @@ YourMoneroRequests::login_and_start_search_thread(
void
YourMoneroRequests::session_close(
const shared_ptr< Session > session, string response_body)
const shared_ptr< Session > session,
string response_body,
int return_code)
{
auto response_headers = make_headers({{"Content-Length",
to_string(response_body.size())}});
session->close(OK, response_body, response_headers);
session->close(return_code, response_body, response_headers);
}

@ -148,7 +148,9 @@ private:
inline void
session_close(const shared_ptr< Session > session, string response_body);
session_close(const shared_ptr< Session > session,
string response_body,
int return_code = OK);
bool
parse_request(const Bytes& body,

Loading…
Cancel
Save