Skip to content

Commit 91a998f

Browse files
committed
Catch saveCache exceptions
1 parent 5201a79 commit 91a998f

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

action-runner/dist/index.js

Lines changed: 9 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

action-runner/src/main.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,14 @@ export async function onMessage(ws: WebSocket, msg: any) {
101101

102102
ws.send(JSON.stringify({result: (nodeEval(toEval, 'expreval', vars, true) as any).result}))
103103
} else if (json.type == 'save-cache') {
104-
const ch = await cache.saveCache(json.paths, json.key)
105-
console.log(`Saved cache from ` + json.paths + ` as ` + json.key)
106-
ws.send(JSON.stringify({id: ch}))
104+
const ch = await cache.saveCache(json.paths, json.key).catch(_ => undefined)
105+
if (ch == undefined) {
106+
console.log(`Cache could not be saved`)
107+
ws.send(JSON.stringify({id: -1}))
108+
} else {
109+
console.log(`Saved cache from ` + json.paths + ` as ` + json.key)
110+
ws.send(JSON.stringify({id: ch}))
111+
}
107112
} else if (json.type == 'restore-cache') {
108113
const ch = await cache.restoreCache(json.paths, json.key)
109114
if (ch) console.log(`Restored cache to ` + json.paths)

0 commit comments

Comments
 (0)