Skip to content

Commit 909b738

Browse files
authored
handle - no executed code exists in error frame (#123)
1 parent e6070ad commit 909b738

File tree

3 files changed

+48
-25
lines changed

3 files changed

+48
-25
lines changed

src/views-ui/codeAnalytics/main.scss

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,18 @@ vscode-panel-view {
190190
&.disabled {
191191
opacity: 0.4;
192192
}
193+
.frame-code-path{
194+
display: flex;
195+
}
193196
}
194197
li:not(:first-of-type) .line {
195198
border-top-width: 1px;
196199
border-top-color: var(--vscode-tree-tableColumnsBorder);
197200
border-top-style: dashed;
198201
}
202+
.path-label{
203+
204+
}
199205
}
200206
.no-frames-msg {
201207
padding: 1em;
@@ -227,17 +233,16 @@ vscode-panel-view {
227233
width: 100%;
228234
}
229235
.bottom-line .link-cell {
230-
display: block;
231236
text-overflow: ellipsis;
232237
white-space: nowrap;
233238
overflow: hidden;
234-
flex: 1;
235239
}
236240
.bottom-line .number-cell {
237-
display: inline-flex;
238-
align-items: flex-end;
239241
opacity: 0.4;
240-
margin-left: 10px;
242+
padding-left: 10px;
243+
margin-left: auto;
244+
margin-top: auto;
245+
min-width: fit-content;
241246
}
242247
.stack-details-section {
243248
flex-grow: 1;
@@ -351,7 +356,7 @@ vscode-panel-view {
351356
display: flex;
352357
align-items: center;
353358
margin-top: 10px;
354-
width: 100%;
359+
355360
.scope {
356361
margin-right: 5px;
357362
opacity: 0.6;
@@ -424,4 +429,15 @@ vscode-panel-view {
424429
opacity: 0.6;
425430
}
426431
}
432+
}
433+
434+
.frame-span {
435+
display: flex;
436+
align-items: center;
437+
margin-top: 10px;
438+
color: #4F62AD;
439+
.codicon {
440+
margin-right: 5px;
441+
padding-top: 1px;
442+
}
427443
}

src/views/codeAnalytics/errorFlowStackRenderer.ts

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface StackViewModel {
1919

2020
export interface FrameViewModel extends ErrorFlowFrame {
2121
id: number;
22-
stackIndex: number;
22+
internalIndex: number;//frameIndex inside the stack
2323
selected: boolean;
2424
workspaceUri?: vscode.Uri;
2525
parameters: ParamStats[];
@@ -132,7 +132,7 @@ export class ErrorFlowStackRenderer {
132132
private getAffectedPathSectionHtml()
133133
{
134134
const errorService = this._viewModel?.summary?.serviceName ?? '';
135-
const errorSpanNames = this._viewModel?.stacks.flatMap(s => s.frames).filter(f => f.stackIndex == 0).map(f => f.spanName) ?? [];
135+
const errorSpanNames = this._viewModel?.stacks.flatMap(s => s.frames).filter(f => f.internalIndex == 0).map(f => f.spanName) ?? [];
136136

137137
function getTree(affectedPath: AffectedPathViewModel, level: any): string
138138
{
@@ -241,12 +241,9 @@ export class ErrorFlowStackRenderer {
241241
for (const frame of frames ){
242242
if (frame.spanName !== lastSpan){
243243
stackHtml += `
244-
<div style="color: #4F62AD;" class="list ellipsis">
245-
<span>
246-
<span>${frame.spanName}</span>
247-
<span style="color:#4F62AD;line-height:25px;margin-right:5px" class="codicon codicon-telescope">
248-
</span>
249-
</span>
244+
<div class="frame-span">
245+
<span class="codicon codicon-telescope" title="OpenTelemetry"></span>
246+
<span class="left-ellipsis" title="${frame.spanName}">${frame.spanName}</span>
250247
</div>`;
251248

252249
lastSpan = frame.spanName;
@@ -272,22 +269,32 @@ export class ErrorFlowStackRenderer {
272269
const selectedClass = frame.selected ? "selected" : "";
273270
const disabledClass = frame.workspaceUri ? "" : "disabled";
274271
const hidden = Settings.hideFramesOutsideWorkspace.value && !frame.workspaceUri ? "hidden" : "";
275-
276-
let exception_html = '<span style="color:#f14c4c;line-height:25px;margin-right:5px" class="codicon codicon-symbol-event"> </span>';
277-
278-
let linkTag = frame.workspaceUri
272+
const showExceptionIcon = frame.internalIndex===0;
273+
let exceptionHtml = '<span style="color:#f14c4c;margin-right:5px" class="codicon codicon-symbol-event"> </span>';
274+
let executedCodeHtml = '';
275+
if(frame.executedCode){
276+
executedCodeHtml = frame.workspaceUri
279277
? /*html*/`<vscode-link class="link-cell" data-frame-id="${frame.id}" title="${frame.executedCode}">${frame.executedCode}</vscode-link>`
280278
: /*html*/`<span class="link-cell look-like-link" title="${frame.executedCode}">${frame.executedCode}</span>`;
281-
282-
if (frame.stackIndex===0){
283-
linkTag= exception_html+linkTag;
279+
if (showExceptionIcon){
280+
executedCodeHtml = exceptionHtml+executedCodeHtml;
281+
}
282+
}
283+
let pathHtml = `<div class="left-ellipsis" title="${path}">${path}</div>`;
284+
if(executedCodeHtml === ''){
285+
if(frame.workspaceUri){
286+
pathHtml = /*html*/`<vscode-link class="link-cell" data-frame-id="${frame.id}" title="${path}">${path}</vscode-link>`;
287+
}
288+
if (showExceptionIcon){
289+
pathHtml = `<div class="frame-code-path">${exceptionHtml}${pathHtml}</div>`;
290+
}
284291
}
285292
return /*html*/`
286293
<li class="${frame.workspaceUri?'inside-workspace':'outside-workspace'}" ${hidden}>
287294
<div class="line ${selectedClass} ${disabledClass}">
288-
<div class="left-ellipsis" title="${path}">${path}</div>
295+
${pathHtml}
289296
<div class="bottom-line">
290-
${linkTag}
297+
${executedCodeHtml}
291298
<div class="number-cell">line ${frame.lineNumber}</div>
292299
</div>
293300
</div>

src/views/codeAnalytics/errorsViewTab.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export class ErrorsViewTab implements ICodeAnalyticsViewTab
206206

207207
for await (const sourceStack of sourceFlow.frameStacks) {
208208
const frames: FrameViewModel[] = [];
209-
209+
let internalIndex = 0;
210210
for await (const sourceFrame of sourceStack.frames) {
211211
const {
212212
spanName,
@@ -229,7 +229,7 @@ export class ErrorsViewTab implements ICodeAnalyticsViewTab
229229

230230
const frame: FrameViewModel = {
231231
id: id++,
232-
stackIndex: 0,
232+
internalIndex: internalIndex++,
233233
selected: false,
234234
parameters,
235235
spanName,

0 commit comments

Comments
 (0)