Skip to content

Commit 2687065

Browse files
committed
Improve error messages
1 parent 2b33094 commit 2687065

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

index.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,14 +368,17 @@
368368
detail: null,
369369
};
370370

371-
// Check for common error patterns
372-
if (
371+
// Check for common error patterns — check backend status-based
372+
// messages first, then fall back to registry error codes.
373+
if (errorMessage.includes("image not found")) {
374+
result.title = "Image Not Found";
375+
result.message = "The requested image does not exist.";
376+
} else if (
373377
errorMessage.includes("MANIFEST_UNKNOWN") ||
374378
errorMessage.includes("manifest unknown")
375379
) {
376380
result.title = "Image Not Found";
377381
result.message = "The requested image tag does not exist.";
378-
// Try to extract the tag
379382
const tagMatch = errorMessage.match(
380383
/unknown tag=([^\s}"]+)/,
381384
);
@@ -388,6 +391,10 @@
388391
) {
389392
result.title = "Repository Not Found";
390393
result.message = "The requested repository does not exist.";
394+
} else if (errorMessage.includes("access denied")) {
395+
result.title = "Access Denied";
396+
result.message =
397+
"The image may not exist, or you may need credentials to access it.";
391398
} else if (
392399
errorMessage.includes("UNAUTHORIZED") ||
393400
errorMessage.includes("unauthorized")

registry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ func (c *RegistryClient) fetchToken(realm, service, scope string, creds Registry
237237
if resp.StatusCode != http.StatusOK {
238238
body, _ := io.ReadAll(io.LimitReader(resp.Body, 4096))
239239
log.WithField("response_body", string(body)).WithField("status_code", resp.StatusCode).Debug("Authentication request failed")
240-
return "", fmt.Errorf("authentication failed (status %d): check credentials, or the image may not exist or may be private — %s", resp.StatusCode, string(body))
240+
return "", fmt.Errorf("authentication failed (status %d): check credentials or verify the image exists", resp.StatusCode)
241241
}
242242

243243
var tokenResp struct {

0 commit comments

Comments
 (0)