chore: treat caught error as unknown

This commit is contained in:
Kengo TODA
2021-08-29 14:37:54 +08:00
committed by probot-auto-merge[bot]
parent c0bf818478
commit 3268a385e5
3 changed files with 7 additions and 7 deletions

10
dist/index.js vendored
View File

@@ -22,7 +22,7 @@ const exec_1 = __nccwpck_require__(514);
function runCommand(command) { function runCommand(command) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let output = ''; let output = '';
const result = yield exec_1.exec(command, [], { const result = yield (0, exec_1.exec)(command, [], {
listeners: { listeners: {
stdout: (data) => { stdout: (data) => {
output += data.toString(); output += data.toString();
@@ -41,8 +41,8 @@ function installOnLinux(version) {
const system = runCommand('uname -s'); const system = runCommand('uname -s');
const hardware = runCommand('uname -m'); const hardware = runCommand('uname -m');
const url = `https://github.com/docker/compose/releases/download/${version}/docker-compose-${yield system}-${yield hardware}`; const url = `https://github.com/docker/compose/releases/download/${version}/docker-compose-${yield system}-${yield hardware}`;
const installerPath = yield tool_cache_1.downloadTool(url); const installerPath = yield (0, tool_cache_1.downloadTool)(url);
yield exec_1.exec(`chmod +x ${installerPath}`); yield (0, exec_1.exec)(`chmod +x ${installerPath}`);
return installerPath; return installerPath;
}); });
} }
@@ -103,11 +103,11 @@ function run() {
const version = core.getInput('version', { const version = core.getInput('version', {
required: true required: true
}); });
const commandPath = yield install_1.install(version); const commandPath = yield (0, install_1.install)(version);
core.addPath(commandPath); core.addPath(commandPath);
} }
catch (error) { catch (error) {
core.setFailed(error.message); core.setFailed(error instanceof Error ? error.message : "Unknown error");
} }
}); });
} }

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@@ -9,7 +9,7 @@ async function run(): Promise<void> {
const commandPath = await install(version) const commandPath = await install(version)
core.addPath(commandPath) core.addPath(commandPath)
} catch (error) { } catch (error) {
core.setFailed(error.message) core.setFailed(error instanceof Error ? error.message : 'Unknown error')
} }
} }