Skip to content

Commit

Permalink
src: handle out-of-size errors, and collisions gracefully (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
aayushshah15 authored Feb 3, 2025
1 parent fe36458 commit bafb57e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
16 changes: 16 additions & 0 deletions dist/setup/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/setup/index.js.map

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions src/lib/cache/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@ export function getCacheClient() {
}
} else if (reserveCacheResponse?.statusCode === 409) {
return { success: false }
} else if (reserveCacheResponse?.statusCode === 400) {
// Handle specific 400 error cases
const message = reserveCacheResponse.result?.message || 'Unknown error'

if (message.includes('Cache size exceeds maximum')) {
core.warning(message)
} else if (message.includes('Cache entry already exists')) {
core.info(message)
} else {
core.warning(`Unexpected 400 error: ${message}`)
}

// Don't continue if we have a 400 error since in all these cases we know we don't
// want to save the cache blob.
return { success: false }
} else {
const { statusCode, statusText } = reserveCacheResponse
const data = reserveCacheResponse.result
Expand Down

0 comments on commit bafb57e

Please sign in to comment.