Skip to content
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
7 changes: 6 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ function findComment(inputs) {
return undefined;
});
}
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 @@ -118,7 +123,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
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ async function findComment(inputs: Inputs): Promise<Comment | undefined> {
return undefined
}

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

async function run(): Promise<void> {
try {
const inputs: Inputs = {
Expand All @@ -89,9 +94,9 @@ async function run(): Promise<void> {
core.setOutput('comment-body', '')
core.setOutput('comment-author', '')
}
} catch (error: any) {
} catch (error) {
core.debug(inspect(error))
core.setFailed(error.message)
core.setFailed(getErrorMessage(error))
}
}

Expand Down