Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Commit

Permalink
refactor: unify error rendering between client and server
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaSemenov committed Jan 5, 2019
1 parent bd5726d commit 5f0926c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/create-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const Error = {
}
}

function createRootComponent(entry, context) {
function createRootComponent(entry) {
const { root = Root, error = Error } = entry

return {
Expand Down Expand Up @@ -114,7 +114,7 @@ function createRootComponent(entry, context) {
},
computed: {
actualError() {
const error = context.req ? context.reamError : this.error
const error = this.error
if (error && error.errorPath) {
return error.errorPath === this.$route.path ? error : null
}
Expand All @@ -139,7 +139,7 @@ export default function createApp(context) {
}

const rootOptions = {
...createRootComponent(entry, context),
...createRootComponent(entry),
_isReamRoot: true,
router: entry.router || new Router({ mode: 'history' })
}
Expand Down
2 changes: 1 addition & 1 deletion app/server-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default async context => {
if (matchedComponents.length === 0) {
if (res) {
res.statusCode = 404
context.reamError = pageNotFound(req.url)
app.setError(pageNotFound(req.url))
} else {
throw new ReamError({
code: 'NOT_FOUND',
Expand Down

0 comments on commit 5f0926c

Please sign in to comment.