Skip to content

Replace use of any type #628

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function run() {
}
catch (error) {
core.debug((0, util_1.inspect)(error));
core.setFailed(error.message);
core.setFailed(utils.getErrorMessage(error));
}
});
}
Expand Down Expand Up @@ -151,7 +151,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getStringAsArray = exports.getInputAsArray = void 0;
exports.getErrorMessage = exports.getStringAsArray = exports.getInputAsArray = void 0;
const core = __importStar(__nccwpck_require__(2186));
function getInputAsArray(name, options) {
return getStringAsArray(core.getInput(name, options));
Expand All @@ -164,6 +164,12 @@ function getStringAsArray(str) {
.filter(x => x !== '');
}
exports.getStringAsArray = getStringAsArray;
function getErrorMessage(error) {
if (error instanceof Error)
return error.message;
return String(error);
}
exports.getErrorMessage = getErrorMessage;


/***/ }),
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ async function run(): Promise<void> {
} else {
core.info(`File not found at path '${inputs.contentFilepath}'`)
}
} catch (error: any) {
} catch (error) {
core.debug(inspect(error))
core.setFailed(error.message)
core.setFailed(utils.getErrorMessage(error))
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ export function getStringAsArray(str: string): string[] {
.map(s => s.trim())
.filter(x => x !== '')
}

export function getErrorMessage(error: unknown) {
if (error instanceof Error) return error.message
return String(error)
}