mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
parent
0195679fac
commit
4d6bcf4978
@ -34,7 +34,9 @@ export default class ErrorBoundary extends React.Component<
|
||||
const errorDescription = typeof description === 'undefined' ? componentStack : description;
|
||||
if (error) {
|
||||
// You can render any custom fallback UI
|
||||
return <Alert type="error" message={errorMessage} description={errorDescription} />;
|
||||
return (
|
||||
<Alert type="error" message={errorMessage} description={<pre>{errorDescription}</pre>} />
|
||||
);
|
||||
}
|
||||
return children;
|
||||
}
|
||||
|
@ -13,10 +13,11 @@ exports[`Alert ErrorBoundary 1`] = `
|
||||
<span
|
||||
class="ant-alert-description"
|
||||
>
|
||||
|
||||
in ThrowError
|
||||
<pre>
|
||||
in ThrowError
|
||||
in ErrorBoundary (created by WrapperComponent)
|
||||
in WrapperComponent
|
||||
</pre>
|
||||
</span>
|
||||
</div>
|
||||
`;
|
||||
|
@ -68,8 +68,9 @@
|
||||
color: @alert-error-icon-color;
|
||||
}
|
||||
|
||||
.@{alert-prefix-cls}-description {
|
||||
white-space: pre;
|
||||
.@{alert-prefix-cls}-description > pre {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user