public Response get(String urlPath, String cookie) throws RetrievalFailedException {
try {
Response result = get(httpGetMethod().withUrl(ApiEndpointUtils.REDDIT_BASE_URL + urlPath).withCookie(cookie));
if (result == null) {
throw new RetrievalFailedException("The given URI path does not exist on Reddit: " + urlPath);
} else {
return result;
}
} catch (URISyntaxException e) {
throw new RetrievalFailedException("The syntax of the URI path was incorrect: " + urlPath);
} catch (InvalidURIException e) {
throw new RetrievalFailedException("The URI path was invalid: " + urlPath);
} catch (IOException e) {
throw new RetrievalFailedException("Input/output failed when retrieving from URI path: " + urlPath);
} catch (ParseException e) {
throw new RetrievalFailedException("Failed to parse the response from GET request to URI path: "+ urlPath);
}
}