d19e825daa
* add initial custom-routes handling * Add tests for custom-routes * Handle chained redirects, separate dev custom routes reading, and add version to routes manifest * Handle no routes manifest * Swap build custom routes calling * Add flatten-routes * Add flattening of custom routes * Re-work implementation to follow routes top-down * Add regex field to routes-manifest * Fix path-to-regexp match breaking after upgrade * Fix duplicate const from merge * Add some changes from review * Don't make path-match strict * add default custom route values * Update routes-manifest * Update options for path-match * Remove todo * Add test for rewrite with params * Only use strict mode for custom routes * Update dynamic-routing test * Move getCustomRoutes to prepare * Remove extra change * Update handling for error-in-error test * Apply suggestions from code review Co-Authored-By: Joe Haddad <joe.haddad@zeit.co> * Apply suggestions from review * Update slice change * Apply suggestions from code review Co-Authored-By: Joe Haddad <joe.haddad@zeit.co> * Apply suggestions from review * Fix TypeScript error * Fix getCustomRoutes in dev mode * Apply suggestions from code review * Update slice * Apply suggestions from code review Co-Authored-By: Joe Haddad <joe.haddad@zeit.co> * Delete un-used test page * Add test for param overwriting * Apply suggestions from code review Co-Authored-By: Joe Haddad <joe.haddad@zeit.co> * Add extra check to param test
23 lines
546 B
JavaScript
23 lines
546 B
JavaScript
import React from 'react'
|
|
|
|
class Error extends React.Component {
|
|
static async getInitialProps ({ req, res, err }) {
|
|
if (req.url !== '/404.html') {
|
|
await Promise.reject(new Error('an error in error'))
|
|
}
|
|
const statusCode = res ? res.statusCode : err ? err.statusCode : null
|
|
return { statusCode }
|
|
}
|
|
|
|
render () {
|
|
return (
|
|
<p>
|
|
{this.props.statusCode
|
|
? `An error ${this.props.statusCode} occurred on server`
|
|
: 'An error occurred on client'}
|
|
</p>
|
|
)
|
|
}
|
|
}
|
|
|
|
export default Error
|