-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Custom error page in <Layout error={MyError} /> not show #8528
Comments
Hi, and thanks for your question. For support question ("How To", usage advice, or troubleshooting your own code), you have three options:
So I'm closing this issue, and inviting you to ask your question in one of the support channels above. |
This is not how-to, etc question. There is the bug in documentation or code. I did everything as described in tutorial, double tested, create clean separate sandbox for it and it doesn't work. |
If you think you have found a bug, then you should follow the issue template (completely), and provide a codesandbox based on the simple example of react-admin. Besides, in the case of your example, even if you remove your custom error page, you won't see the default error page. This is because the error you trigger happens outside the scope of the You should try to make it appear with a different kind of error, for example updating an inexistant resource or throwing an error inside a mutation side-effect, or something in this taste. |
Thanks. I thing that API errors must covered ErrorBoundary. I'm wrong? Now I'm get only notification on API server errors. How can I catch API server errors on separate page? Please give me an advise or example. |
You could probably wrap your whole App inside your own |
Thank you for not leaving me alone in trouble. I posted a question on Stackoverflow, there are no answers yet. I double-checked everything again. Now I am absolutely sure that I have identified either an error in the documentation or an error in the code. The project has tag label:documentation and there is not 1 issue. I created a clean React-Admin sandbox in which I added the code from the instructions from the page https://marmelab.com/react-admin/Theming.html#customizing-the-error-page Sandbox: https://codesandbox.io/p/github/lumpov/react-admin/master For error please click on error-resource Provoked an error inside React-Admin, but it appears only in bottom notifications. This means that the error is in the React-Admin scope. The error page, as described in the documentation, does not show. And I apologise, I issued the issue according to the requirements described in the hidden comments, what did I not specify? |
As you have found out with your codesandbox, the custom error page will only appear for specific types of errors.
Besides, as I already pointed out, we put the ErrorBoundary component around the main container only, but not the Menu nor the AppBar. This is to allow the user to navigate away from the error when it happens. So, I don't think this is something we can/should change in the code, but I figured you are correct about the docs being a bit misleading about when the Error Page will be shown. |
thanks guys! @fzaninotto one more thing. Maybe this is a separate issue, but related to error handling. For example, in the ListView.tsx: <Error error={error} resetErrorBoundary={null} /> That is, with any Layout.tsx: <ErrorBoundary
onError={handleError}
fallbackRender={({ error, resetErrorBoundary }) => (
<Error
error={error}
errorComponent={errorComponent}
errorInfo={errorInfo}
resetErrorBoundary={resetErrorBoundary}
title={title}
/>
)}
>
{children}
</ErrorBoundary> I think that in Please consider this and can I issue a new issue? |
I would like to use custom error page (
src/error.js
) as described in https://marmelab.com/react-admin/Theming.html#customizing-the-error-pageCustom error page don't show on server error.
Sandbox https://codesandbox.io/p/github/lumpov/react-admin/master
Click on
error
-resource.Environment
The text was updated successfully, but these errors were encountered: