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

Method _formatException

valdi/vscode_debugger/src/adapter/threads.ts:1087–1123  ·  view source on GitHub ↗
(
    details: Cdp.Runtime.ExceptionDetails,
    prefix?: string,
  )

Source from the content-addressed store, hash-verified

1085 }
1086
1087 async _formatException(
1088 details: Cdp.Runtime.ExceptionDetails,
1089 prefix?: string,
1090 ): Promise<Dap.OutputEventParams> {
1091 const preview = details.exception
1092 ? objectPreview.previewException(details.exception)
1093 : { title: '' };
1094 let message = preview.title;
1095 if (!message.startsWith('Uncaught')) message = 'Uncaught ' + message;
1096 message = (prefix || '') + message;
1097
1098 let stackTrace: StackTrace | undefined;
1099 let uiLocation: IUiLocation | undefined;
1100 if (details.stackTrace) stackTrace = StackTrace.fromRuntime(this, details.stackTrace);
1101 if (stackTrace) {
1102 const frames = await stackTrace.loadFrames(1);
1103 if (frames.length) uiLocation = await frames[0].uiLocation();
1104 }
1105
1106 const args = details.exception && !preview.stackTrace ? [details.exception] : [];
1107 let variablesReference = 0;
1108 if (stackTrace || args.length)
1109 variablesReference = await this.replVariables.createVariableForOutput(
1110 message,
1111 args,
1112 stackTrace,
1113 );
1114
1115 return {
1116 category: 'stderr',
1117 output: message,
1118 variablesReference,
1119 source: uiLocation ? await uiLocation.source.toDap() : undefined,
1120 line: uiLocation ? uiLocation.lineNumber : undefined,
1121 column: uiLocation ? uiLocation.columnNumber : undefined,
1122 };
1123 }
1124
1125 scriptsFromSource(source: Source): Set<Script> {
1126 return this._sourceScripts.get(source) || new Set();

Callers 2

_evaluateReplMethod · 0.95
_initializeMethod · 0.95

Calls 6

startsWithMethod · 0.80
loadFramesMethod · 0.80
uiLocationMethod · 0.80
fromRuntimeMethod · 0.45
toDapMethod · 0.45

Tested by

no test coverage detected