Skip to content

Commit 1c07572

Browse files
committed
Check also for positive numbers in code (Closes #44)
1 parent 3887871 commit 1c07572

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/jsonrpccxx/common.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ namespace jsonrpccxx {
4646
const char *what() const noexcept override { return err.c_str(); }
4747

4848
static inline JsonRpcException fromJson(const json &value) {
49-
bool has_code = has_key_type(value, "code", json::value_t::number_integer);
49+
bool has_code = has_key_type(value, "code", json::value_t::number_integer) || has_key_type(value, "code", json::value_t::number_unsigned);
5050
bool has_message = has_key_type(value, "message", json::value_t::string);
5151
bool has_data = has_key(value, "data");
5252
if (has_code && has_message) {
@@ -56,7 +56,7 @@ namespace jsonrpccxx {
5656
return JsonRpcException(value["code"], value["message"]);
5757
}
5858
}
59-
return JsonRpcException(internal_error, R"(invalid error response: "code" (negative number) and "message" (string) are required)");
59+
return JsonRpcException(internal_error, R"(invalid error response: "code" (integer number) and "message" (string) are required)");
6060
}
6161

6262
private:

0 commit comments

Comments
 (0)