Skip to content

Positive error codes are not recognized as integers in JsonRpcException fromJson(const json &value) #44

Closed
@eniv

Description

@eniv

According to Niels in order to check if a number is integer it is not enough to compare the type to number_integer as executed in fromJson() [common.hpp]

bool has_code = has_key_type(value, "code", json::value_t::number_integer);

This is what the json library does:

    constexpr bool is_number_integer() const noexcept
    {
        return m_type == value_t::number_integer || m_type == value_t::number_unsigned;
    }

Easiest fix is:

bool has_code = has_key_type(value, "code", json::value_t::number_integer) || has_key_type(value, "code", json::value_t::number_unsigned);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions