Files
setup-task/src/main.ts
per1234 e7ea1aa3ef Narrow caught exceptions
The update to 4.4.2 brings increased type strictness. Previously, exceptions were used in some catch blocks based on an
assumption of their type. But exceptions can have any type and that now results in errors (TS2345, TS2571). This is fixed
by narrowing the exceptions to the expected type before using them as such.
2021-09-01 03:35:11 -07:00

32 lines
1.0 KiB
TypeScript

// Copyright (c) 2019 ARDUINO SA
//
// The software is released under the GNU General Public License, which covers the main body
// of the arduino/setup-task code. The terms of this license can be found at:
// https://www.gnu.org/licenses/gpl-3.0.en.html
//
// You can be released from the requirements of the above licenses by purchasing
// a commercial license. Buying such a license is mandatory if you want to modify or
// otherwise use the software for commercial activities involving the Arduino
// software without disclosing the source code of your own applications. To purchase
// a commercial license, send an email to license@arduino.cc
import * as core from "@actions/core";
import * as installer from "./installer";
async function run() {
try {
const version = core.getInput("version", { required: true });
const repoToken = core.getInput("repo-token");
await installer.getTask(version, repoToken);
} catch (error) {
if (error instanceof Error) {
core.setFailed(error.message);
} else {
throw error;
}
}
}
run();