Skip to content

NullPointer for a response with error #83

@splix

Description

@splix

The following code in HttpClient:

JsonNode errorJson = new ObjectMapper().readTree(httpConnection.getErrorStream());
if (errorJson != null) {
      errorText = errorJson.get("error").asText();
}

fails with NullPointerException on .asText() call because the API doesn't provide such field. It only has:

{"type":"api_parsing_error","message":"...","pos":{"line":1,"column":53,"id":0,"location":"query"}}

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