Skip to content
This repository has been archived by the owner on Mar 10, 2023. It is now read-only.

Commit

Permalink
fix(error-handler): error page was not displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan Girod committed Feb 23, 2017
1 parent bfc3d4a commit f0c900d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/server/middlewares/errorHandler.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ const errorToErrorContext = (ctx, error) => ({
const renderError = (ctx, error) => {
try {
const errorContext = errorToErrorContext(ctx, error);
this.body = renderErrorPage(errorContext);
ctx.body = renderErrorPage(errorContext);
onError(errorContext);
} catch (renderingError) {
this.body = renderRawError(ctx.status, renderingError);
ctx.body = renderRawError(ctx.status, renderingError);
onError(errorToErrorContext(ctx, renderingError));
}
this.type = 'html';
ctx.type = 'html';
};

export default () => async (ctx, next) => {
Expand All @@ -82,6 +82,7 @@ export default () => async (ctx, next) => {
ctx.status = 500;
renderError(ctx, error);
}

if (ctx.status === 404) {
if (ctx.state.store) {
renderError(ctx);
Expand Down

0 comments on commit f0c900d

Please sign in to comment.