Skip to content

Commit

Permalink
fix: sql lab crash caused by invalid template (#17133)
Browse files Browse the repository at this point in the history
  • Loading branch information
Grace Guo authored Oct 18, 2021
1 parent d7834f1 commit 96f4421
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function ParameterErrorMessage({
source = 'sqllab',
subtitle,
}: ErrorMessageComponentProps<ParameterErrorExtra>) {
const { extra, level, message } = error;
const { extra = { issue_codes: [] }, level, message } = error;

const triggerMessage = tn(
'This was triggered by:',
Expand Down Expand Up @@ -99,9 +99,10 @@ function ParameterErrorMessage({
)}
{triggerMessage}
<br />
{extra.issue_codes
.map<React.ReactNode>(issueCode => <IssueCode {...issueCode} />)
.reduce((prev, curr) => [prev, <br />, curr])}
{extra.issue_codes.length > 0 &&
extra.issue_codes
.map<React.ReactNode>(issueCode => <IssueCode {...issueCode} />)
.reduce((prev, curr) => [prev, <br />, curr])}
</p>
</>
);
Expand Down

0 comments on commit 96f4421

Please sign in to comment.