(err: Error)
| 91 | private handledErrors = new WeakSet<Error>(); |
| 92 | private handledKernelErrors = new WeakSet<Error>(); |
| 93 | public async handleError(err: Error): Promise<void> { |
| 94 | logger.warn('DataScience Error', err); |
| 95 | err = WrappedError.unwrap(err); |
| 96 | if (this.handledErrors.has(err)) { |
| 97 | return; |
| 98 | } |
| 99 | this.handledErrors.add(err); |
| 100 | if (err instanceof JupyterInstallError) { |
| 101 | await this.dependencyManager?.installMissingDependencies(err); |
| 102 | } else if (err instanceof JupyterSelfCertsError) { |
| 103 | await handleSelfCertsError(this.configuration, err.message); |
| 104 | } else if (err instanceof JupyterExpiredCertsError) { |
| 105 | await handleExpiredCertsError(this.configuration, err.message); |
| 106 | } else if (isCancellationError(err)) { |
| 107 | // Don't show the message for cancellation errors |
| 108 | } else if (err instanceof KernelConnectionTimeoutError || err instanceof KernelPortNotUsedTimeoutError) { |
| 109 | window.showErrorMessage(err.message).then(noop, noop); |
| 110 | } else if ( |
| 111 | err instanceof KernelDiedError || |
| 112 | err instanceof KernelProcessExitedError || |
| 113 | err instanceof JupyterNotebookNotInstalled || |
| 114 | err instanceof JupyterConnectError |
| 115 | ) { |
| 116 | window.showErrorMessage(getUserFriendlyErrorMessage(err)).then(noop, noop); |
| 117 | } else if (err instanceof RemoteJupyterServerConnectionError && isWebExtension()) { |
| 118 | // Special case for a failure on web |
| 119 | window.showErrorMessage(DataScience.jupyterNotebookRemoteConnectFailedWeb(err.baseUrl)).then(noop, noop); |
| 120 | } else if (err instanceof RemoteJupyterServerConnectionError) { |
| 121 | const message = await this.handleJupyterServerConnectionError(err, undefined); |
| 122 | window.showErrorMessage(message).then(noop, noop); |
| 123 | } else if (err instanceof RemoteJupyterServerUriProviderError) { |
| 124 | const message = await this.handleJupyterServerUriProviderError(err, undefined); |
| 125 | window.showErrorMessage(message).then(noop, noop); |
| 126 | } else { |
| 127 | // Some errors have localized and/or formatted error messages. |
| 128 | const message = getCombinedErrorMessage(err.message || err.toString()); |
| 129 | window.showErrorMessage(message).then(noop, noop); |
| 130 | } |
| 131 | } |
| 132 | public async getErrorMessageForDisplayInCell(error: Error, errorContext: KernelAction, resource: Resource) { |
| 133 | return this.getErrorMessageForDisplayInCellImpl(error, errorContext, resource, false); |
| 134 | } |
nothing calls this directly
no test coverage detected