mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Add cross browser stacktrace (#776)
* Add cross browser stacktrace * Remove unused stack variable
This commit is contained in:
parent
6fd5cfd87d
commit
8318f5b8de
|
@ -2,7 +2,7 @@ import React from 'react'
|
||||||
import ansiHTML from 'ansi-html'
|
import ansiHTML from 'ansi-html'
|
||||||
import Head from './head'
|
import Head from './head'
|
||||||
|
|
||||||
export default ({ err: { name, message, stack, module } }) => (
|
export default ({ err, err: { name, message, module } }) => (
|
||||||
<div style={styles.errorDebug}>
|
<div style={styles.errorDebug}>
|
||||||
<Head>
|
<Head>
|
||||||
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
|
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
|
||||||
|
@ -11,11 +11,20 @@ export default ({ err: { name, message, stack, module } }) => (
|
||||||
{
|
{
|
||||||
name === 'ModuleBuildError'
|
name === 'ModuleBuildError'
|
||||||
? <pre style={styles.message} dangerouslySetInnerHTML={{ __html: ansiHTML(encodeHtml(message)) }} />
|
? <pre style={styles.message} dangerouslySetInnerHTML={{ __html: ansiHTML(encodeHtml(message)) }} />
|
||||||
: <pre style={styles.message}>{stack}</pre>
|
: <StackTrace error={err} />
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const StackTrace = ({ error: { name, message, stack } }) => (
|
||||||
|
<div>
|
||||||
|
<div style={styles.heading}>{name && message && `${name}: ${message}`}</div>
|
||||||
|
<pre style={styles.message}>
|
||||||
|
{stack}
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
|
||||||
const styles = {
|
const styles = {
|
||||||
errorDebug: {
|
errorDebug: {
|
||||||
background: '#a6004c',
|
background: '#a6004c',
|
||||||
|
|
Loading…
Reference in a new issue