Skip to content

Commit b238ed7

Browse files
committed
frontend/latex/build: cleaner error due to problem vs. "informational" distinction
1 parent 7c84190 commit b238ed7

File tree

1 file changed

+15
-5
lines changed
  • src/packages/frontend/frame-editors/latex-editor

1 file changed

+15
-5
lines changed

src/packages/frontend/frame-editors/latex-editor/build.tsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ export const Build: React.FC<Props> = React.memo((props) => {
8989
margin: "0",
9090
} as const;
9191

92+
function renderErrorHeader(errorIsInformational: boolean): string {
93+
return errorIsInformational ? "Output messages" : "Error output";
94+
}
95+
9296
function render_tab_item(
9397
title: string,
9498
stdout: string,
@@ -175,13 +179,15 @@ export const Build: React.FC<Props> = React.memo((props) => {
175179
fontSize: `${font_size * 0.9}px`,
176180
}}
177181
>
178-
{stderrIsInformational ? "Output messages" : "Error output"}
182+
{renderErrorHeader(stderrIsInformational)}
179183
</div>
180184
<div
181185
style={{
182186
flex: 1,
183187
overflowY: "auto",
184-
background: error ? COLORS.ANTD_BG_RED_L : COLORS.GRAY_LLL,
188+
background: stderrIsInformational
189+
? COLORS.GRAY_LLL
190+
: COLORS.ANTD_BG_RED_L,
185191
padding: "5px",
186192
borderRadius: "3px",
187193
}}
@@ -296,6 +302,7 @@ export const Build: React.FC<Props> = React.memo((props) => {
296302
let isLongRunning = false;
297303
let stdoutTail = "";
298304
let stderrTail = "";
305+
let errorIsInformational = false;
299306

300307
build_logs.forEach((infoI, key) => {
301308
const info: ExecuteCodeOutput = infoI?.toJS();
@@ -304,13 +311,16 @@ export const Build: React.FC<Props> = React.memo((props) => {
304311
const start = info.start;
305312
stdoutTail = tail(info.stdout ?? "", 100);
306313
stderrTail = tail(info.stderr ?? "", 100);
307-
// Update state for auto-scrolling effect - combine for backward compatibility
314+
// Update state for auto-scrolling effect
308315
const combinedLog =
309316
stdoutTail +
310-
(stderrTail ? "\n--- Error Output ---\n" + stderrTail : "");
317+
(stderrTail
318+
? `\n--- ${renderErrorHeader(!info.exit_code)} ---\n` + stderrTail
319+
: "");
311320
if (combinedLog !== shownLog) {
312321
setShownLog(combinedLog);
313322
}
323+
errorIsInformational = !info.exit_code;
314324
isLongRunning ||=
315325
typeof start === "number" &&
316326
webapp_client.server_time() - start > WARN_LONG_RUNNING_S * 1000;
@@ -451,7 +461,7 @@ export const Build: React.FC<Props> = React.memo((props) => {
451461
flexShrink: 0,
452462
}}
453463
>
454-
Error output (stderr)
464+
{renderErrorHeader(errorIsInformational)} (stderr)
455465
</div>
456466
<div
457467
ref={stderrContainerRef}

0 commit comments

Comments
 (0)