Skip to content

Commit 72904f1

Browse files
authored
1 parent def9801 commit 72904f1

4 files changed

Lines changed: 40 additions & 12 deletions

File tree

packages/databricks-vscode/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@
531531
"@types/triple-beam": "^1.3.2",
532532
"@vscode/debugadapter": "^1.58.0",
533533
"@vscode/webview-ui-toolkit": "^1.1.0",
534+
"ansi-to-html": "^0.7.2",
534535
"triple-beam": "^1.3.0"
535536
},
536537
"devDependencies": {

packages/databricks-vscode/src/run/WorkflowRunner.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {SyncDestination} from "../configuration/SyncDestination";
1919
import {CodeSynchronizer} from "../sync/CodeSynchronizer";
2020
import {isNotebook} from "../utils";
2121
import {WorkflowOutputPanel} from "./WorkflowOutputPanel";
22+
import Convert from "ansi-to-html";
2223

2324
export class WorkflowRunner implements Disposable {
2425
private panels = new Map<string, WorkflowOutputPanel>();
@@ -135,7 +136,7 @@ export class WorkflowRunner implements Disposable {
135136
message: e.message,
136137
stack:
137138
"error_trace" in e.response
138-
? e.response.error_trace
139+
? new Convert().toHtml(e.response.error_trace)
139140
: undefined,
140141
});
141142
} else {

packages/databricks-vscode/webview-ui/job.html

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@
9393
display: none;
9494
}
9595

96+
#error-stack {
97+
margin-top: 10px;
98+
white-space: pre;
99+
font-family: monospace;
100+
}
101+
96102
.alert-error .error-icon {
97103
display: inline-block;
98104
padding: 0 8px;
@@ -166,7 +172,7 @@
166172
</span>
167173
<div>
168174
<b id="error-description"></b>
169-
<pre id="error-stack"></pre>
175+
<div id="error-stack"></div>
170176
</div>
171177
</div>
172178
</div>
@@ -279,7 +285,7 @@
279285

280286
document.getElementById("error-description").innerText =
281287
message || "";
282-
document.getElementById("error-stack").innerText =
288+
document.getElementById("error-stack").innerHTML =
283289
stack || "";
284290
}
285291
}
@@ -330,18 +336,19 @@
330336
setTimeout(() => {
331337
page.setError(
332338
`SyntaxError: invalid syntax (hello.py, line 10)`,
333-
`Traceback (most recent call last):
339+
`SyntaxError: invalid syntax (hello.py, line 9)
340+
Traceback <span style="color:#0AA">(most recent call last)</span>:
334341
335-
File [1;32m"/databricks/python/lib/python3.9/site-packages/IPython/core/interactiveshell.py"[0m, line [1;32m3524[0m, in [1;35mrun_code[0m
336-
exec(code_obj, self.user_global_ns, self.user_ns)
342+
File <b><span style="color:#0A0">"/databricks/python/lib/python3.9/site-packages/IPython/core/interactiveshell.py"</span></b>, line <b><span style="color:#0A0">3524</span></b>, in <b><span style="color:#A0A">run_code</span></b>
343+
exec(code_obj, self.user_global_ns, self.user_ns)
337344
338-
[0;36m File [0;32m""[0;36m, line [0;32m8[0;36m, in [0;35m[0;36m[0m
339-
[0;31m exec(compile(f.read(), filename, 'exec'))[0m
345+
<span style="color:#0AA"> File </span><span style="color:#0A0">"<command--1>"</span><span style="color:#0AA">, line </span><span style="color:#0A0">8</span><span style="color:#0AA">, in </span><span style="color:#A0A"><cell line: 7></span><span style="color:#0AA"></span>
346+
<span style="color:#A00"> exec(compile(f.read(), filename, 'exec'))</span>
340347
341-
[0;36m File [0;32m"/Workspace/Repos/fabian.jakobs@databricks.com/notebook-best-practices/jobs/hello.py"[0;36m, line [0;32m10[0m
342-
[0;31m pri nt("Hi Deco")[0m
343-
[0m ^[0m
344-
[0;31mSyntaxError[0m[0;31m:[0m invalid syntax`
348+
<span style="color:#0AA"> File </span><span style="color:#0A0">"/Workspace/Repos/fabian.jakobs@databricks.com/ide-best-practices/jobs/hello.py"</span><span style="color:#0AA">, line </span><span style="color:#0A0">9</span>
349+
<span style="color:#A00"> pr int("Hi Deco")</span>
350+
^
351+
<span style="color:#A00">SyntaxError</span><span style="color:#A00">:</span> invalid syntax`
345352
);
346353
stop();
347354
}, 3000);

yarn.lock

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,17 @@ __metadata:
11691169
languageName: node
11701170
linkType: hard
11711171

1172+
"ansi-to-html@npm:^0.7.2":
1173+
version: 0.7.2
1174+
resolution: "ansi-to-html@npm:0.7.2"
1175+
dependencies:
1176+
entities: ^2.2.0
1177+
bin:
1178+
ansi-to-html: bin/ansi-to-html
1179+
checksum: 8f6ecec6e0d01c37a36541703688870a2a89382117229c54b1af19f455cb87d4645b0b8580691edb50d531fa02dfb7e2b8af3d0768e1527d4164d1e124286516
1180+
languageName: node
1181+
linkType: hard
1182+
11721183
"anymatch@npm:~3.1.2":
11731184
version: 3.1.2
11741185
resolution: "anymatch@npm:3.1.2"
@@ -2142,6 +2153,7 @@ __metadata:
21422153
"@vscode/debugadapter": ^1.58.0
21432154
"@vscode/test-electron": ^2.2.0
21442155
"@vscode/webview-ui-toolkit": ^1.1.0
2156+
ansi-to-html: ^0.7.2
21452157
esbuild: ^0.15.13
21462158
eslint: ^8.26.0
21472159
fs-extra: ^10.1.0
@@ -2415,6 +2427,13 @@ __metadata:
24152427
languageName: node
24162428
linkType: hard
24172429

2430+
"entities@npm:^2.2.0":
2431+
version: 2.2.0
2432+
resolution: "entities@npm:2.2.0"
2433+
checksum: 19010dacaf0912c895ea262b4f6128574f9ccf8d4b3b65c7e8334ad0079b3706376360e28d8843ff50a78aabcb8f08f0a32dbfacdc77e47ed77ca08b713669b3
2434+
languageName: node
2435+
linkType: hard
2436+
24182437
"entities@npm:^4.2.0, entities@npm:^4.3.0, entities@npm:^4.4.0":
24192438
version: 4.4.0
24202439
resolution: "entities@npm:4.4.0"

0 commit comments

Comments
 (0)