本文整理汇总了TypeScript中vs/base/common/errorMessage.toErrorMessage函数的典型用法代码示例。如果您正苦于以下问题:TypeScript toErrorMessage函数的具体用法?TypeScript toErrorMessage怎么用?TypeScript toErrorMessage使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了toErrorMessage函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: toErrorMessage
this.call(traverse, this, folderQuery, onResult, onMessage, (err?: Error) => {
if (err) {
const errorMessage = toErrorMessage(err);
console.error(errorMessage);
this.errors.push(errorMessage);
rootFolderDone(err, undefined);
} else {
rootFolderDone(undefined, undefined);
}
});
示例2: onDidNotificationChange
private onDidNotificationChange(e: INotificationChangeEvent): void {
if (e.kind === NotificationChangeType.ADD) {
// ARIA alert for screen readers
this.ariaAlert(e.item);
// Always log errors to console with full details
if (e.item.severity === Severity.Error) {
console.error(toErrorMessage(e.item.message.value, true));
}
}
}
示例3: rootFolderDone
this.call(traverse, this, folderQuery, onResult, (err?: Error) => {
if (err) {
if (isNodeTraversal) {
rootFolderDone(err, undefined);
} else {
// fallback
const errorMessage = toErrorMessage(err);
console.error(errorMessage);
this.errors.push(errorMessage);
this.nodeJSTraversal(folderQuery, onResult, err => rootFolderDone(err, undefined));
}
} else {
rootFolderDone(undefined, undefined);
}
});
示例4: rootFolderDone
this.call(traverse, this, rootFolder, onResult, (err?: Error) => {
if (err) {
if (isNodeTraversal) {
rootFolderDone(err);
} else {
// fallback
const errorMessage = toErrorMessage(err);
console.error(errorMessage);
this.errors.push(errorMessage);
this.nodeJSTraversal(rootFolder, onResult, rootFolderDone);
}
} else {
rootFolderDone();
}
});
示例5: test
test('Get Error Message', function () {
assert.strictEqual(toErrorMessage('Foo Bar'), 'Foo Bar');
assert.strictEqual(toErrorMessage(new Error('Foo Bar')), 'Foo Bar');
var error: any = new Error();
error.status = 404;
error.statusText = 'Not Found';
assert.strictEqual(toErrorMessage(error), 'Not Found (HTTP 404)');
error = new Error();
error.detail = {};
error.detail.exception = {};
error.detail.exception.message = 'Foo Bar';
assert.strictEqual(toErrorMessage(error), 'Foo Bar');
error = new Error();
error.detail = {};
error.detail.error = {};
error.detail.error.status = 404;
error.detail.error.statusText = 'Not Found';
assert.strictEqual(toErrorMessage(error), 'Not Found (HTTP 404)');
error = new Error();
error.detail = {};
error.detail.error = [];
var foo: any = {};
error.detail.error.push(foo);
foo.status = 404;
foo.statusText = 'Not Found';
assert.strictEqual(toErrorMessage(error), 'Not Found (HTTP 404)');
assert(toErrorMessage());
assert(toErrorMessage(null));
assert(toErrorMessage({}));
});
示例6: doShow
private doShow(sev: Severity, message: any): () => void {
// Check flag if we can show a message now
if (!this.canShowMessages) {
const messageObj: IBufferedMessage = { severity: sev, message, disposeFn: () => this.messageBuffer.splice(this.messageBuffer.indexOf(messageObj), 1) };
this.messageBuffer.push(messageObj);
// Return function that allows to remove message from buffer
return () => messageObj.disposeFn();
}
// Show in Console
if (sev === Severity.Error) {
console.error(toErrorMessage(message, true));
}
// Show in Global Handler
return this.handler.showMessage(this.toBaseSeverity(sev), message);
}
示例7: test
test('Get Error Message', function () {
assert.strictEqual(toErrorMessage('Foo Bar'), 'Foo Bar');
assert.strictEqual(toErrorMessage(new Error('Foo Bar')), 'Foo Bar');
let error: any = new Error();
error = new Error();
error.detail = {};
error.detail.exception = {};
error.detail.exception.message = 'Foo Bar';
assert.strictEqual(toErrorMessage(error), 'Foo Bar');
assert(toErrorMessage());
assert(toErrorMessage(null));
assert(toErrorMessage({}));
});
示例8: toErrorMessage
return textFileService.revertAll(resources, { force: true }).then(null, error => {
notificationService.error(nls.localize('genericRevertError', "Failed to revert '{0}': {1}", resources.map(r => paths.basename(r.fsPath)).join(', '), toErrorMessage(error, false)));
});
示例9: basename
return textFileService.revertAll(resources, { force: true }).then(null, error => {
messageService.show(Severity.Error, nls.localize('genericRevertError', "Failed to revert '{0}': {1}", basename(resource.fsPath), toErrorMessage(error, false)));
});