diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 912f0c411..0704173e5 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -69,7 +69,7 @@ void RPCTypeCheck(const Array& params, { string err = strprintf("Expected type %s, got %s", Value_type_name[t], Value_type_name[v.type()]); - throw JSONRPCError(-3, err); + throw JSONRPCError(RPC_TYPE_ERROR, err); } i++; } @@ -83,13 +83,13 @@ void RPCTypeCheck(const Object& o, { const Value& v = find_value(o, t.first); if (!fAllowNull && v.type() == null_type) - throw JSONRPCError(-3, strprintf("Missing %s", t.first.c_str())); + throw JSONRPCError(RPC_TYPE_ERROR, strprintf("Missing %s", t.first.c_str())); if (!((v.type() == t.second) || (fAllowNull && (v.type() == null_type)))) { string err = strprintf("Expected type %s for %s, got %s", Value_type_name[t.second], t.first.c_str(), Value_type_name[v.type()]); - throw JSONRPCError(-3, err); + throw JSONRPCError(RPC_TYPE_ERROR, err); } } } @@ -98,10 +98,10 @@ int64 AmountFromValue(const Value& value) { double dAmount = value.get_real(); if (dAmount <= 0.0 || dAmount > 21000000.0) - throw JSONRPCError(-3, "Invalid amount"); + throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount"); int64 nAmount = roundint64(dAmount * COIN); if (!MoneyRange(nAmount)) - throw JSONRPCError(-3, "Invalid amount"); + throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount"); return nAmount; } @@ -317,7 +317,7 @@ string rfc1123Time() static string HTTPReply(int nStatus, const string& strMsg, bool keepalive) { - if (nStatus == 401) + if (nStatus == HTTP_UNAUTHORIZED) return strprintf("HTTP/1.0 401 Authorization Required\r\n" "Date: %s\r\n" "Server: bitcoin-json-rpc/%s\r\n" @@ -335,11 +335,11 @@ static string HTTPReply(int nStatus, const string& strMsg, bool keepalive) "