Additional Error Handling

Previously, we prevented any error logs from propagating too far to prevent leaking of any potentially sensitive information. However, this made it difficult for developers to debug their code.

In this release, we have updated our error handling to allow for more error messaging from pre/post and custom commands. We still discourage the use of these commands for secrets or other sensitive information, but we believe this change will make it easier for developers to debug their code.

Relates to #137
This commit is contained in:
Jacob M-G Evans 2023-08-10 10:07:26 -05:00
parent 559dd40fe6
commit 74433eb31e
No known key found for this signature in database
GPG key ID: 2A0C497CAB123094
2 changed files with 22 additions and 2 deletions

View file

@ -0,0 +1,10 @@
---
"wrangler-action": patch
---
Additional Error Handling
Previously, we prevented any error logs from propagating too far to prevent leaking of any potentially sensitive information. However, this made it difficult for developers to debug their code.
In this release, we have updated our error handling to allow for more error messaging from pre/post and custom commands. We still discourage the use of these commands for secrets or other sensitive information, but we believe this change will make it easier for developers to debug their code.
Relates to #137

View file

@ -5,6 +5,7 @@ import {
setFailed,
endGroup,
startGroup,
error,
} from "@actions/core";
import { execSync, exec } from "node:child_process";
import { existsSync } from "node:fs";
@ -114,7 +115,10 @@ async function execCommands(commands: string[], cmdType: string) {
});
});
await Promise.all(arrPromises);
await Promise.all(arrPromises).catch((result) => {
error(`🚨 ${cmdType} Command failed`);
setFailed(result);
});
endGroup();
}
@ -264,10 +268,16 @@ async function wranglerCommands() {
env: process.env,
},
);
info(result.stdout);
return result;
});
await Promise.all(arrPromises);
await Promise.all(arrPromises).catch((result) => {
error(`🚨 Command failed`);
setFailed(result.stderr);
});
endGroup();
}