mirror of
https://github.com/github/codeql-action.git
synced 2025-12-31 11:40:24 +08:00
Refactoring: Simplify retrieving error message
This commit is contained in:
@@ -998,8 +998,14 @@ export function wrapError(error: unknown): Error {
|
||||
return error instanceof Error ? error : new Error(String(error));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an appropriate message for the error.
|
||||
*
|
||||
* If the error is an `Error` instance, this returns the error message without
|
||||
* an `Error: ` prefix.
|
||||
*/
|
||||
export function getErrorMessage(error: unknown): string {
|
||||
return error instanceof Error ? error.toString() : String(error);
|
||||
return error instanceof Error ? error.message : String(error);
|
||||
}
|
||||
|
||||
export function prettyPrintPack(pack: Pack) {
|
||||
|
||||
Reference in New Issue
Block a user