Skip to content

Commit

Permalink
Merge pull request #76 from peter-evans/fix-any
Browse files Browse the repository at this point in the history
fix: replace use of any type
  • Loading branch information
peter-evans committed Oct 21, 2022
2 parents 1488116 + 3b9f4f2 commit 0b9f9c4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 6 additions & 1 deletion dist/index.js
Expand Up @@ -212,6 +212,11 @@ const inputHelper = __importStar(__nccwpck_require__(5480));
const dockerhubHelper = __importStar(__nccwpck_require__(1812));
const fs = __importStar(__nccwpck_require__(7147));
const util_1 = __nccwpck_require__(3837);
function getErrorMessage(error) {
if (error instanceof Error)
return error.message;
return String(error);
}
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
Expand All @@ -232,7 +237,7 @@ function run() {
}
catch (error) {
core.debug((0, util_1.inspect)(error));
core.setFailed(error.message);
core.setFailed(getErrorMessage(error));
}
});
}
Expand Down
9 changes: 7 additions & 2 deletions src/main.ts
Expand Up @@ -4,6 +4,11 @@ import * as dockerhubHelper from './dockerhub-helper'
import * as fs from 'fs'
import {inspect} from 'util'

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

async function run(): Promise<void> {
try {
const inputs = inputHelper.getInputs()
Expand Down Expand Up @@ -31,9 +36,9 @@ async function run(): Promise<void> {
readmeContent
)
core.info('Request successful')
} catch (error: any) {
} catch (error) {
core.debug(inspect(error))
core.setFailed(error.message)
core.setFailed(getErrorMessage(error))
}
}

Expand Down

0 comments on commit 0b9f9c4

Please sign in to comment.