本文整理匯總了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)));
});