2016-10-19 12:41:45 +00:00
|
|
|
import React from 'react'
|
|
|
|
import stripAnsi from 'strip-ansi'
|
|
|
|
import Head from 'next/head'
|
2016-10-25 08:16:54 +00:00
|
|
|
import style from 'next/css'
|
2016-10-19 12:41:45 +00:00
|
|
|
|
|
|
|
export default class ErrorDebug extends React.Component {
|
|
|
|
static getInitialProps ({ err }) {
|
|
|
|
const { message, module } = err
|
|
|
|
return { message, path: module.rawRequest }
|
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
const { message, path } = this.props
|
|
|
|
|
2016-10-21 16:39:20 +00:00
|
|
|
return <div className={styles.errorDebug}>
|
2016-10-19 12:41:45 +00:00
|
|
|
<Head>
|
|
|
|
<style dangerouslySetInnerHTML={{ __html: `
|
|
|
|
body {
|
|
|
|
background: #dc0067;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
`}} />
|
|
|
|
</Head>
|
2016-10-21 16:39:20 +00:00
|
|
|
<div className={styles.heading}>Error in {path}</div>
|
|
|
|
<pre className={styles.message}>{stripAnsi(message)}</pre>
|
2016-10-19 12:41:45 +00:00
|
|
|
</div>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-21 16:39:20 +00:00
|
|
|
const styles = {
|
|
|
|
body: style({
|
2016-10-19 12:41:45 +00:00
|
|
|
background: '#dc0067',
|
|
|
|
margin: 0
|
2016-10-21 16:39:20 +00:00
|
|
|
}),
|
2016-10-19 12:41:45 +00:00
|
|
|
|
2016-10-21 16:39:20 +00:00
|
|
|
errorDebug: style({
|
2016-10-19 12:41:45 +00:00
|
|
|
height: '100%',
|
|
|
|
padding: '16px',
|
|
|
|
boxSizing: 'border-box'
|
2016-10-21 16:39:20 +00:00
|
|
|
}),
|
2016-10-19 12:41:45 +00:00
|
|
|
|
2016-10-21 16:39:20 +00:00
|
|
|
message: style({
|
2016-10-19 12:41:45 +00:00
|
|
|
fontFamily: 'menlo-regular',
|
|
|
|
fontSize: '10px',
|
|
|
|
color: '#fff',
|
|
|
|
margin: 0
|
2016-10-21 16:39:20 +00:00
|
|
|
}),
|
2016-10-19 12:41:45 +00:00
|
|
|
|
2016-10-21 16:39:20 +00:00
|
|
|
heading: style({
|
2016-10-19 12:41:45 +00:00
|
|
|
fontFamily: 'sans-serif',
|
|
|
|
fontSize: '13px',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
color: '#ff90c6',
|
|
|
|
marginBottom: '20px'
|
2016-10-21 16:39:20 +00:00
|
|
|
})
|
|
|
|
}
|