Report all 4xx from write-latex API as MissingRepositoryException

This commit is contained in:
Michael Walker
2018-02-06 13:30:30 +00:00
parent 6ae6acd826
commit 82c0873743
3 changed files with 45 additions and 8 deletions
@@ -70,14 +70,12 @@ public abstract class Request<T extends Result> {
Throwable cause = e.getCause();
if (cause instanceof HttpResponseException) {
HttpResponseException httpCause = (HttpResponseException) cause;
switch (httpCause.getStatusCode()) {
case HttpServletResponse.SC_UNAUTHORIZED:
case HttpServletResponse.SC_FORBIDDEN:
throw new ForbiddenException();
case HttpServletResponse.SC_GONE:
throw new MissingRepositoryException();
default:
break;
int sc = httpCause.getStatusCode();
if (sc == HttpServletResponse.SC_UNAUTHORIZED || sc == HttpServletResponse.SC_FORBIDDEN) {
throw new ForbiddenException();
}
if (sc >= 400 && sc < 500) {
throw new MissingRepositoryException();
}
throw new FailedConnectionException(cause);
} else {