Ensure full stack traces are included in log messages

Pass in the `fullMessage` to `internalShowAndLog` so that stack traces
aren't truncated.
This commit is contained in:
Andrew Eisenberg
2023-05-16 14:48:19 -07:00
parent e9552df395
commit 276e2cfdcf
2 changed files with 2 additions and 2 deletions

View File

@@ -49,7 +49,6 @@ export function registerCommandWithErrorHandling(
const errorMessage = redactableError(error)`${
getErrorMessage(e) || e
} (${commandId})`;
const errorStack = getErrorStack(e);
if (e instanceof UserCancellationException) {
// User has cancelled this action manually
if (e.silent) {
@@ -61,6 +60,7 @@ export function registerCommandWithErrorHandling(
}
} else {
// Include the full stack in the error log only.
const errorStack = getErrorStack(e);
const fullMessage = errorStack
? `${errorMessage.fullMessage}\n${errorStack}`
: errorMessage.fullMessage;

View File

@@ -98,7 +98,7 @@ export async function showAndLogErrorMessage(
return internalShowAndLog(
dropLinesExceptInitial(message),
Window.showErrorMessage,
options,
{ fullMessage: message, ...options },
);
}