mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-04-25 20:19:12 +00:00
finish off error handling
This commit is contained in:
parent
02056c5faf
commit
1b8d90b24b
2 changed files with 24 additions and 3 deletions
|
@ -83,7 +83,7 @@ class RoleypolyApp extends App {
|
||||||
` }} />
|
` }} />
|
||||||
</Head>
|
</Head>
|
||||||
<Layout user={user} {...layout}>
|
<Layout user={user} {...layout}>
|
||||||
<ErrorCaughtComponent {...pageProps} router={router} />
|
<ErrorCaughtComponent {...pageProps} router={router} originalName={Component.displayName || Component.constructor.name} />
|
||||||
</Layout>
|
</Layout>
|
||||||
</Container>
|
</Container>
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,6 +127,23 @@ export default class CustomErrorPage extends React.Component {
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderServer () {
|
||||||
|
return <div>
|
||||||
|
<Overlay />
|
||||||
|
<ResponsiveSplitter>
|
||||||
|
<div>
|
||||||
|
<Code>Oops.</Code>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<section>
|
||||||
|
Server was unhappy about this render. Try reloading or changing page.
|
||||||
|
</section>
|
||||||
|
<JapaneseFlair>クッキーを送ってください〜</JapaneseFlair>
|
||||||
|
</div>
|
||||||
|
</ResponsiveSplitter>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
handlers = {
|
handlers = {
|
||||||
403: this.render403,
|
403: this.render403,
|
||||||
404: this.render404,
|
404: this.render404,
|
||||||
|
@ -134,10 +151,14 @@ export default class CustomErrorPage extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
|
if (this.props.originalName === 'ErrorPage') {
|
||||||
|
return this.renderServer()
|
||||||
|
}
|
||||||
|
|
||||||
if (this.props.statusCode in this.handlers) {
|
if (this.props.statusCode in this.handlers) {
|
||||||
return this.handlers[this.props.statusCode]()
|
return this.handlers[this.props.statusCode]()
|
||||||
} else {
|
|
||||||
return this.renderDefault()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return this.renderDefault()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue