Improving error message when projects fail to load (#22786)

* Improving message when project fails to load

* Cleaning up string
This commit is contained in:
Benjin Dubishar
2023-04-20 14:00:43 -07:00
committed by GitHub
parent 8613176817
commit 2142c706b0
3 changed files with 18 additions and 6 deletions

View File

@@ -91,3 +91,12 @@ export async function showInfoMessageWithLearnMoreLink(message: string, link: st
void vscode.env.openExternal(vscode.Uri.parse(link));
}
}
/**
* Consolidates on the error message string
*/
export function getErrorMessage(error: any): string {
return (error instanceof Error)
? (typeof error.message === 'string' ? error.message : '')
: typeof error === 'string' ? error : `${JSON.stringify(error, undefined, '\t')}`;
}