* Launches the debug target, returning any the resolved result. Does a * bunch of mangling to log things, catch uncaught errors, * and format timeouts correctly.
(
launcher: ILauncher,
params: AnyLaunchConfiguration,
cancellationToken: CancellationToken,
)
| 288 | * and format timeouts correctly. |
| 289 | */ |
| 290 | private async captureLaunch( |
| 291 | launcher: ILauncher, |
| 292 | params: AnyLaunchConfiguration, |
| 293 | cancellationToken: CancellationToken, |
| 294 | ): Promise<ILaunchResult> { |
| 295 | const name = launcher.constructor.name; |
| 296 | |
| 297 | let result: ILaunchResult; |
| 298 | try { |
| 299 | result = await launcher.launch(params, { |
| 300 | telemetryReporter: this._rootServices.get(ITelemetryReporter), |
| 301 | cancellationToken, |
| 302 | targetOrigin: this._targetOrigin, |
| 303 | dap: await this._dap, |
| 304 | }); |
| 305 | } catch (e) { |
| 306 | this._rootServices.get<ILogger>(ILogger).warn(LogTag.RuntimeLaunch, 'Launch returned error', { |
| 307 | error: e, |
| 308 | wasCancelled: cancellationToken.isCancellationRequested, |
| 309 | name, |
| 310 | }); |
| 311 | |
| 312 | throw e; |
| 313 | } |
| 314 | |
| 315 | if (result.blockSessionTermination) { |
| 316 | this._rootServices |
| 317 | .get<ILogger>(ILogger) |
| 318 | .info(LogTag.RuntimeLaunch, 'Launched successfully', { name }); |
| 319 | } |
| 320 | |
| 321 | return result; |
| 322 | } |
| 323 | |
| 324 | dispose() { |
| 325 | for (const disposable of this._disposables) disposable.dispose(); |