Skip to content

Commit

Permalink
fix: sql lab crash caused by invalid template (apache#17133)
Browse files Browse the repository at this point in the history
  • Loading branch information
Grace Guo authored and Emmanuel Bavoux committed Nov 14, 2021
1 parent 305c704 commit 12ce205
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 12ce205

Please sign in to comment.