forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path_error-debug.js
68 lines (58 loc) · 1.28 KB
/
_error-debug.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import React from 'react'
import stripAnsi from 'strip-ansi'
import Head from 'next/head'
import { css, StyleSheet } from 'next/css'
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
return <div className={css(styles.errorDebug)}>
<Head>
<style dangerouslySetInnerHTML={{ __html: `
body {
background: #dc0067;
margin: 0;
}
`}} />
</Head>
<div className={css(styles.heading)}>Error in {path}</div>
<pre className={css(styles.message)}>{stripAnsi(message)}</pre>
</div>
}
}
const styles = StyleSheet.create({
body: {
background: '#dc0067',
margin: 0
},
errorDebug: {
height: '100%',
padding: '16px',
boxSizing: 'border-box'
},
message: {
fontFamily: 'menlo-regular',
fontSize: '10px',
color: '#fff',
margin: 0
},
heading: {
fontFamily: 'sans-serif',
fontSize: '13px',
fontWeight: 'bold',
color: '#ff90c6',
marginBottom: '20px'
},
token: {
backgroundColor: '#000'
},
marker: {
color: '#000'
},
dim: {
color: '#e85b9b'
}
})