mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Handle errors from the history service
If the history service returns a non-success status code when we request a blob, chances are the payload is not the expected blob contents. We throw an exception in that case, which will abort the git operation.
This commit is contained in:
parent
5ce755c7c0
commit
2430d5fe1d
1 changed files with 7 additions and 2 deletions
|
@ -52,11 +52,16 @@ public class NingHttpClient implements NingHttpClientFacade {
|
||||||
@Override
|
@Override
|
||||||
public byte[] onCompleted(
|
public byte[] onCompleted(
|
||||||
Response response
|
Response response
|
||||||
) throws IOException {
|
) throws Exception {
|
||||||
|
int statusCode = response.getStatusCode();
|
||||||
|
if (statusCode >= 400) {
|
||||||
|
throw new Exception("got status " + statusCode +
|
||||||
|
" fetching " + url);
|
||||||
|
}
|
||||||
byte[] ret = bytes.toByteArray();
|
byte[] ret = bytes.toByteArray();
|
||||||
bytes.close();
|
bytes.close();
|
||||||
log.info(
|
log.info(
|
||||||
response.getStatusCode()
|
statusCode
|
||||||
+ " "
|
+ " "
|
||||||
+ response.getStatusText()
|
+ response.getStatusText()
|
||||||
+ " ("
|
+ " ("
|
||||||
|
|
Loading…
Reference in a new issue