Skip to content

Commit

Permalink
Update error message (#1707)
Browse files Browse the repository at this point in the history
  • Loading branch information
chanseokoh authored May 9, 2019
1 parent c5780f8 commit 88a4f0b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ public DescriptorDigest handleHttpResponseException(HttpResponseException httpRe
ErrorCodes errorCode = ErrorResponseUtil.getErrorCode(httpResponseException);
if (errorCode == ErrorCodes.MANIFEST_INVALID || errorCode == ErrorCodes.TAG_INVALID) {
throw new RegistryErrorExceptionBuilder(getActionDescription(), httpResponseException)
.addReason("Registry may not support Image Manifest Version 2, Schema 2")
.addReason(
"Registry may not support pushing OCI Manifest or "
+ "Docker Image Manifest Version 2, Schema 2")
.build();
}
// rethrow: unhandled error response code.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ public void testHandleHttpResponseException_dockerRegistry_tagInvalid()
new HttpResponseException.Builder(
HttpStatus.SC_BAD_REQUEST, "Bad Request", new HttpHeaders())
.setContent(
"{\"errors\":[{\"code\":\"TAG_INVALID\",\"message\":\"manifest tag did not match URI\"}]}")
"{\"errors\":[{\"code\":\"TAG_INVALID\","
+ "\"message\":\"manifest tag did not match URI\"}]}")
.build();
try {
testManifestPusher.handleHttpResponseException(exception);
Expand All @@ -173,7 +174,8 @@ public void testHandleHttpResponseException_dockerRegistry_tagInvalid()
Assert.assertThat(
ex.getMessage(),
CoreMatchers.containsString(
"Registry may not support Image Manifest Version 2, Schema 2"));
"Registry may not support pushing OCI Manifest or "
+ "Docker Image Manifest Version 2, Schema 2"));
}
}

Expand All @@ -185,7 +187,8 @@ public void testHandleHttpResponseException_dockerRegistry_manifestInvalid()
new HttpResponseException.Builder(
HttpStatus.SC_BAD_REQUEST, "Bad Request", new HttpHeaders())
.setContent(
"{\"errors\":[{\"code\":\"MANIFEST_INVALID\",\"message\":\"manifest invalid\",\"detail\":{}}]}")
"{\"errors\":[{\"code\":\"MANIFEST_INVALID\","
+ "\"message\":\"manifest invalid\",\"detail\":{}}]}")
.build();
try {
testManifestPusher.handleHttpResponseException(exception);
Expand All @@ -195,7 +198,8 @@ public void testHandleHttpResponseException_dockerRegistry_manifestInvalid()
Assert.assertThat(
ex.getMessage(),
CoreMatchers.containsString(
"Registry may not support Image Manifest Version 2, Schema 2"));
"Registry may not support pushing OCI Manifest or "
+ "Docker Image Manifest Version 2, Schema 2"));
}
}

Expand All @@ -206,8 +210,9 @@ public void testHandleHttpResponseException_quayIo() throws HttpResponseExceptio
new HttpResponseException.Builder(
HttpStatus.SC_UNSUPPORTED_MEDIA_TYPE, "UNSUPPORTED MEDIA TYPE", new HttpHeaders())
.setContent(
"{\"errors\":[{\"code\":\"MANIFEST_INVALID\",\"detail\":"
+ "{\"message\":\"manifest schema version not supported\"},\"message\":\"manifest invalid\"}]}")
"{\"errors\":[{\"code\":\"MANIFEST_INVALID\","
+ "\"detail\":{\"message\":\"manifest schema version not supported\"},"
+ "\"message\":\"manifest invalid\"}]}")
.build();
try {
testManifestPusher.handleHttpResponseException(exception);
Expand All @@ -217,7 +222,8 @@ public void testHandleHttpResponseException_quayIo() throws HttpResponseExceptio
Assert.assertThat(
ex.getMessage(),
CoreMatchers.containsString(
"Registry may not support Image Manifest Version 2, Schema 2"));
"Registry may not support pushing OCI Manifest or "
+ "Docker Image Manifest Version 2, Schema 2"));
}
}

Expand Down

0 comments on commit 88a4f0b

Please sign in to comment.