Fix: handle http500 response from shepherd

This commit is contained in:
Laurent Clouet
2022-07-17 11:40:01 +02:00
parent 6ba42a3e29
commit d359397076
2 changed files with 9 additions and 1 deletions

View File

@@ -1090,7 +1090,12 @@ import okhttp3.HttpUrl;
// the client cannot recover from this error (it's server side config) so exit the retry loop // the client cannot recover from this error (it's server side config) so exit the retry loop
confirmJobReturnCode = Type.IMAGE_TOO_LARGE; confirmJobReturnCode = Type.IMAGE_TOO_LARGE;
break retryLoop; break retryLoop;
case ERROR_BAD_RESPONSE:
// set the error and retry on next loop
confirmJobReturnCode = Type.ERROR_BAD_UPLOAD_RESPONSE;
break;
default: default:
// do nothing, try to do a request on the next loop // do nothing, try to do a request on the next loop
break; break;

View File

@@ -641,6 +641,9 @@ public class Server extends Thread {
this.log.error(response.body().string()); this.log.error(response.body().string());
return ServerCode.JOB_VALIDATION_IMAGE_TOO_LARGE; return ServerCode.JOB_VALIDATION_IMAGE_TOO_LARGE;
} }
else if (r == HttpURLConnection.HTTP_INTERNAL_ERROR) {
return ServerCode.ERROR_BAD_RESPONSE;
}
else { else {
this.log.error(String.format("Server::HTTPSendFile Unknown response received from server: %s", response.body().string())); this.log.error(String.format("Server::HTTPSendFile Unknown response received from server: %s", response.body().string()));
} }