in src/main/java/com/spotify/github/v3/clients/GitHubClient.java [1148:1170]
private RequestNotOkException mapException(
final HttpRequest httpRequest, final HttpResponse httpResponse) throws IOException {
String bodyString = Optional.ofNullable(httpResponse.bodyString()).orElse("");
Map<String, List<String>> headersMap = httpResponse.headers();
if (httpResponse.statusCode() == FORBIDDEN) {
if (bodyString.contains("Repository was archived so is read-only")) {
return new ReadOnlyRepositoryException(
httpRequest.method(),
URI.create(httpRequest.url()).getPath(),
httpResponse.statusCode(),
bodyString,
headersMap);
}
}
return new RequestNotOkException(
httpRequest.method(),
URI.create(httpRequest.url()).getPath(),
httpResponse.statusCode(),
bodyString,
headersMap);
}