當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript errorMessage.toErrorMessage函數代碼示例

本文整理匯總了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);
					}
				});
開發者ID:JarnoNijboer,項目名稱:vscode,代碼行數:10,代碼來源:fileSearch.ts

示例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));
			}
		}
	}
開發者ID:AllureFer,項目名稱:vscode,代碼行數:12,代碼來源:notificationsAlerts.ts

示例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);
					}
				});
開發者ID:naturtle,項目名稱:vscode,代碼行數:15,代碼來源:fileSearch.ts

示例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();
					}
				});
開發者ID:FabianLauer,項目名稱:vscode,代碼行數:15,代碼來源:fileSearch.ts

示例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({}));
	});
開發者ID:GYGit,項目名稱:vscode,代碼行數:36,代碼來源:errors.test.ts

示例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);
	}
開發者ID:GYGit,項目名稱:vscode,代碼行數:19,代碼來源:messageService.ts

示例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({}));
	});
開發者ID:DonJayamanne,項目名稱:vscode,代碼行數:15,代碼來源:errors.test.ts

示例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)));
			});
開發者ID:jinlongchen2018,項目名稱:vscode,代碼行數:3,代碼來源:fileCommands.ts

示例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)));
			});
開發者ID:tonycleveland,項目名稱:vscode,代碼行數:3,代碼來源:fileCommands.ts


注:本文中的vs/base/common/errorMessage.toErrorMessage函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。