feat(errorboundary): format stack trace properly (#3931)

This commit is contained in:
Ibrahim 2024-02-14 08:51:17 -05:00 committed by GitHub
parent 40b590d75a
commit 0eac386a31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View File

@ -24,8 +24,12 @@ const DefaultFallback = ({ error, context, resetErrorBoundary, fallbackRoute })
<p className="text-primary-light text-base">{subtitle}</p>
{!isProduction && (
<div className="bg-secondary-dark mt-5 space-y-2 rounded-md p-5 font-mono">
<p className="text-primary-light">{t('Context')}: {context}</p>
<p className="text-primary-light">{t('Error Message')}: {error.message}</p>
<p className="text-primary-light">
{t('Context')}: {context}
</p>
<p className="text-primary-light">
{t('Error Message')}: {error.message}
</p>
<IconButton
variant="contained"
@ -44,7 +48,9 @@ const DefaultFallback = ({ error, context, resetErrorBoundary, fallbackRoute })
</React.Fragment>
</IconButton>
{showDetails && <p className="text-primary-light px-4">Stack: {error.stack}</p>}
{showDetails && (
<pre className="text-primary-light whitespace-pre-wrap px-4">Stack: {error.stack}</pre>
)}
</div>
)}
</div>

View File

@ -53,7 +53,7 @@ const Modal = ({
return (
<ReactModal
className="relative max-h-full w-11/12 text-white outline-none lg:w-10/12 xl:w-1/2"
className="relative max-h-full w-11/12 text-white outline-none lg:w-10/12 xl:w-9/12"
overlayClassName="fixed top-0 left-0 right-0 bottom-0 z-50 bg-overlay flex items-start justify-center py-16"
shouldCloseOnEsc={shouldCloseOnEsc}
onRequestClose={handleClose}