Skip to content

Commit 4400c06

Browse files
committed
alerts/UnexpectedErrorAlert: fix not showing message
This was not showing the actual error message. Also hide the technical details when no stack trace is available.
1 parent 49cc0e2 commit 4400c06

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

src/alerts/UnexpectedErrorAlert.tsx

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,25 @@ const UnexpectedErrorAlert: React.VoidFunctionComponent<UnexpectedErrorAlertProp
2828

2929
return (
3030
<>
31-
<p>{i18n.translate('message', { errorMessage: error.message })}</p>
32-
<span>
33-
<Button
34-
aria-labelledby={labelId}
35-
minimal={true}
36-
small={true}
37-
icon={isExpanded ? 'chevron-down' : 'chevron-right'}
38-
onClick={() => setIsExpanded((v) => !v)}
39-
/>
40-
<span id={labelId}>{i18n.translate('technicalInfo')}</span>
41-
</span>
42-
<Collapse isOpen={isExpanded}>
43-
<Pre className="pb-alerts-stack-trace">{error.stack}</Pre>
44-
</Collapse>
31+
<p>{i18n.translate('message')}</p>
32+
<p>{error.message}</p>
33+
{error.stack && (
34+
<>
35+
<span>
36+
<Button
37+
aria-labelledby={labelId}
38+
minimal={true}
39+
small={true}
40+
icon={isExpanded ? 'chevron-down' : 'chevron-right'}
41+
onClick={() => setIsExpanded((v) => !v)}
42+
/>
43+
<span id={labelId}>{i18n.translate('technicalInfo')}</span>
44+
</span>
45+
<Collapse isOpen={isExpanded}>
46+
<Pre className="pb-alerts-stack-trace">{error.stack}</Pre>
47+
</Collapse>
48+
</>
49+
)}
4550
<div>
4651
<ButtonGroup minimal={true} fill={true}>
4752
<Button

0 commit comments

Comments
 (0)