1
0
Fork 0
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:
Tim Neutkens 2017-01-15 17:17:29 +01:00 committed by Naoyuki Kanezawa
parent 6fd5cfd87d
commit 8318f5b8de

View file

@ -2,7 +2,7 @@ import React from 'react'
import ansiHTML from 'ansi-html'
import Head from './head'
export default ({ err: { name, message, stack, module } }) => (
export default ({ err, err: { name, message, module } }) => (
<div style={styles.errorDebug}>
<Head>
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
@ -11,11 +11,20 @@ export default ({ err: { name, message, stack, module } }) => (
{
name === 'ModuleBuildError'
? <pre style={styles.message} dangerouslySetInnerHTML={{ __html: ansiHTML(encodeHtml(message)) }} />
: <pre style={styles.message}>{stack}</pre>
: <StackTrace error={err} />
}
</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 = {
errorDebug: {
background: '#a6004c',