Skip to content

Commit

Permalink
Fix error page status code
Browse files Browse the repository at this point in the history
  • Loading branch information
torztomasz committed Jul 24, 2023
1 parent 36ffb75 commit 25fd235
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,25 @@ export async function frontendErrorMiddleware(
const givenUser = getGivenUser(ctx)
const context = await pageContextService.getPageContext(givenUser)

switch (ctx.status) {
const statusCode = ctx.status
switch (statusCode) {
case 400:
case 404:
ctx.set({ 'Content-Type': 'text/html' })
ctx.body = renderErrorPage({
context,
statusCode: ctx.status,
statusCode,
message: ctx.customMessage as string,
})
ctx.status = statusCode
break
case 500:
ctx.set({ 'Content-Type': 'text/html' })
ctx.body = renderErrorPage({
context,
statusCode: ctx.status,
statusCode,
})
ctx.status = statusCode
break
}
}

0 comments on commit 25fd235

Please sign in to comment.