提交 dc4a864a 编写于 作者: B Benjamin Pasero

errors - fix stack printing

上级 7b80b25d
......@@ -10,7 +10,7 @@ import * as arrays from 'vs/base/common/arrays';
function exceptionToErrorMessage(exception: any, verbose: boolean): string {
if (exception.message) {
if (verbose && (exception.stack || exception.stacktrace)) {
return nls.localize('stackTrace.format', "{0}: {1}", detectSystemErrorMessage(exception), exception.stack || exception.stacktrace);
return nls.localize('stackTrace.format', "{0}: {1}", detectSystemErrorMessage(exception), stackToString(exception.stack) || stackToString(exception.stacktrace));
}
return detectSystemErrorMessage(exception);
......@@ -19,6 +19,14 @@ function exceptionToErrorMessage(exception: any, verbose: boolean): string {
return nls.localize('error.defaultMessage', "An unknown error occurred. Please consult the log for more details.");
}
function stackToString(stack: string[] | string | undefined): string | undefined {
if (Array.isArray(stack)) {
return stack.join('\n');
}
return stack;
}
function detectSystemErrorMessage(exception: any): string {
// See https://nodejs.org/api/errors.html#errors_class_system_error
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册