/** * Parses the given error HTTP response using the given JSON factory. * * @param jsonFactory JSON factory * @param response HTTP response * @return new instance of the Google JSON error information * @throws IllegalArgumentException if content type is not {@link Json#MEDIA_TYPE} or if expected * {@code "data"} or {@code "error"} key is not found */ public static GoogleJsonError parse(JsonFactory jsonFactory, HttpResponse response) throws IOException { return new JsonCParser(jsonFactory) .parseAndClose(response.getContent(), response.getContentCharset(), GoogleJsonError.class); }