Skip to content

Commit

Permalink
fix: ensure failure is set before attempting to log and handle unknow…
Browse files Browse the repository at this point in the history
…n throws
  • Loading branch information
Codex- committed Oct 2, 2024
1 parent a5d5ff0 commit 2138938
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/return-dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,17 @@ export async function returnDispatch(
core.setFailed("Timeout exceeded while attempting to get Run ID");
} catch (error) {
if (error instanceof Error) {
core.error(`Failed: ${error.message}`);
core.warning("Does the token have the correct permissions?");
const failureMsg = `Failed: An unhandled error has occurred: ${error.message}`;
core.setFailed(failureMsg);
core.error(failureMsg);
core.debug(error.stack ?? "");
core.setFailed(error.message);
} else {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
const failureMsg = `Failed: An unknown error has occurred: ${error}`;
core.setFailed(failureMsg);
core.error(failureMsg);
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
core.debug(error as any);
}
}
}

0 comments on commit 2138938

Please sign in to comment.