Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiErrorBoundary] Use EuiCodeBlock to render error #5359

Merged
merged 4 commits into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Fixed an `EuiDataGrid` race condition where grid rows had incorrect heights if loaded in before CSS ([#5284](https://github.com/elastic/eui/pull/5284))
- Fixed an accessibility issue where `EuiDataGrid` cells weren't owned by `role=row` elements ([#5285](https://github.com/elastic/eui/pull/5285))
- Fixed `EuiErrorBoundary` overflow scrolling by wrapping contents in `EuiCodeBlock` ([#5359](https://github.com/elastic/eui/pull/5359))

## [`41.0.0`](https://github.com/elastic/eui/tree/v41.0.0)

Expand Down
10 changes: 0 additions & 10 deletions src/components/error_boundary/_error_boundary.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,5 @@
$color2 1px,
$color2 20px
);
overflow: auto;
padding: $euiSize;
}

.euiErrorBoundary__text {
background-color: $euiColorEmptyShade;
padding: $euiSizeS;
}

.euiErrorBoundary__stack {
white-space: pre-wrap;
}
20 changes: 11 additions & 9 deletions src/components/error_boundary/error_boundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import React, { Component, HTMLAttributes, ReactNode } from 'react';
import { CommonProps } from '../common';
import classNames from 'classnames';

import { EuiText } from '../text';
import { EuiTitle } from '../title';
import { EuiCodeBlock } from '../code';
import { EuiI18n } from '../i18n';

interface EuiErrorBoundaryState {
hasError: boolean;
Expand Down Expand Up @@ -66,14 +68,14 @@ ${stackStr}`;
data-test-subj={dataTestSubj}
{...rest}
>
<div className="euiErrorBoundary__text">
<EuiText size="xs">
<h1>Error</h1>
<pre className="euiErrorBoundary__stack">
<p>{this.state.error}</p>
</pre>
</EuiText>
</div>
<EuiCodeBlock>
<EuiTitle size="xs">
<p>
<EuiI18n token="euiErrorBoundary.error" default="Error" />
</p>
</EuiTitle>
{this.state.error}
</EuiCodeBlock>
</div>
);
}
Expand Down