MCPcopy Create free account
hub / github.com/Snapchat/Valdi / _evaluateRepl

Method _evaluateRepl

valdi/vscode_debugger/src/adapter/threads.ts:435–457  ·  view source on GitHub ↗
(
    responsePromise:
      | Promise<Cdp.Runtime.EvaluateResult | undefined>
      | Promise<Cdp.Debugger.EvaluateOnCallFrameResult | undefined>,
  )

Source from the content-addressed store, hash-verified

433 }
434
435 async _evaluateRepl(
436 responsePromise:
437 | Promise<Cdp.Runtime.EvaluateResult | undefined>
438 | Promise<Cdp.Debugger.EvaluateOnCallFrameResult | undefined>,
439 ): Promise<Dap.EvaluateResult | Dap.Error> {
440 const response = await responsePromise;
441 if (!response) return { result: '', variablesReference: 0 };
442
443 if (response.exceptionDetails) {
444 const formattedException = await this._formatException(response.exceptionDetails);
445 throw new errors.ProtocolError(errors.replError(formattedException.output));
446 } else {
447 const contextName =
448 this._selectedContext && this.defaultExecutionContext() !== this._selectedContext
449 ? `\x1b[33m[${this._delegate.executionContextName(this._selectedContext.description)}] `
450 : '';
451 const resultVar = await this.replVariables.createVariable(response.result, 'repl');
452 return {
453 variablesReference: resultVar.variablesReference,
454 result: `${contextName}${resultVar.value}`,
455 };
456 }
457 }
458
459 private _initialize() {
460 this._cdp.Runtime.on('executionContextCreated', event => {

Callers 1

evaluateMethod · 0.95

Calls 4

_formatExceptionMethod · 0.95
createVariableMethod · 0.80
executionContextNameMethod · 0.65

Tested by

no test coverage detected