|
1 |
| -import { Disposable, Event, LogOutputChannel, MarkdownString, Uri } from 'vscode'; |
| 1 | +import { CancellationError, Disposable, Event, LogOutputChannel, MarkdownString, Uri } from 'vscode'; |
2 | 2 | import {
|
3 | 3 | PythonEnvironment,
|
4 | 4 | EnvironmentManager,
|
@@ -28,6 +28,8 @@ import {
|
28 | 28 | CreateEnvironmentOptions,
|
29 | 29 | } from './api';
|
30 | 30 | import { CreateEnvironmentNotSupported, RemoveEnvironmentNotSupported } from './common/errors/NotSupportedError';
|
| 31 | +import { sendTelemetryEvent } from './common/telemetry/sender'; |
| 32 | +import { EventNames } from './common/telemetry/constants'; |
31 | 33 |
|
32 | 34 | export type EnvironmentManagerScope = undefined | string | Uri | PythonEnvironment;
|
33 | 35 | export type PackageManagerScope = undefined | string | Uri | PythonEnvironment | Package;
|
@@ -241,8 +243,21 @@ export class InternalPackageManager implements PackageManager {
|
241 | 243 | return this.manager.log;
|
242 | 244 | }
|
243 | 245 |
|
244 |
| - manage(environment: PythonEnvironment, options: PackageManagementOptions): Promise<void> { |
245 |
| - return this.manager.manage(environment, options); |
| 246 | + async manage(environment: PythonEnvironment, options: PackageManagementOptions): Promise<void> { |
| 247 | + try { |
| 248 | + await this.manager.manage(environment, options); |
| 249 | + sendTelemetryEvent(EventNames.PACKAGE_MANAGEMENT, undefined, { managerId: this.id, result: 'success' }); |
| 250 | + } catch (error) { |
| 251 | + if (error instanceof CancellationError) { |
| 252 | + sendTelemetryEvent(EventNames.PACKAGE_MANAGEMENT, undefined, { |
| 253 | + managerId: this.id, |
| 254 | + result: 'cancelled', |
| 255 | + }); |
| 256 | + throw error; |
| 257 | + } |
| 258 | + sendTelemetryEvent(EventNames.PACKAGE_MANAGEMENT, undefined, { managerId: this.id, result: 'error' }); |
| 259 | + throw error; |
| 260 | + } |
246 | 261 | }
|
247 | 262 |
|
248 | 263 | refresh(environment: PythonEnvironment): Promise<void> {
|
|
0 commit comments