-
Notifications
You must be signed in to change notification settings - Fork 42
Custom 500 page #10
Comments
You can add a route |
Perhaps this could just be a string field in Ream's config? For example:
|
I think it's a good idea to export |
https://ream.js.org/guide/custom-error-page.html Now it handles 404 error using a Vue component. |
Are contributions still welcome? I need a custom 500 page but my latest PRs seem to be stuck. |
For now I'm using this app enhancer plugin to show error page on demand (plus a catch block inside export default ({
ssrContext,
router,
event,
getInitialDataContext
}) => {
getInitialDataContext(context => {
context.error = function (error) { // eslint-disable-line handle-callback-err
if (error instanceof Error) {
error = {
code: 500,
stack: __DEV__ && error.stack // eslint-disable-line no-undef
}
}
router.app.setError(error)
}
})
event.$on('before-server-render', () => {
const error = router.app.error
if (error) {
ssrContext.globalState.error = ssrContext.reamError = error
if (error.code >= 400 && error.code < 600) {
ssrContext.res.statusCode = error.code
}
}
})
event.$on('before-client-render', () => {
const error = window.__REAM__.error
if (error) {
router.app.setError(error)
}
})
} |
This is because on the server side, the global data is handled uniformly via I believe we can just unify the two into single Then I think |
Replace window.__REAM__ with client-side context.globalState. See ream/ream#10 (comment)
No description provided.
The text was updated successfully, but these errors were encountered: