1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Use ErrorDebug component on error of react-hot-loader (#852)

* use ErrorDebug component for reporter of react-hot-loader

* app: fix props of ErrorDebug
This commit is contained in:
Naoyuki Kanezawa 2017-01-22 03:46:18 +09:00 committed by Guillermo Rauch
parent cec8f9dd58
commit 98e2951f0c
2 changed files with 4 additions and 4 deletions

View file

@ -22,7 +22,7 @@ export default class App extends Component {
return <div> return <div>
<Container {...containerProps} /> <Container {...containerProps} />
{ErrorDebug && err ? <ErrorDebug err={err} /> : null} {ErrorDebug && err ? <ErrorDebug error={err} /> : null}
</div> </div>
} }
@ -40,7 +40,7 @@ class Container extends Component {
// includes AppContainer which bypasses shouldComponentUpdate method // includes AppContainer which bypasses shouldComponentUpdate method
// https://github.com/gaearon/react-hot-loader/issues/442 // https://github.com/gaearon/react-hot-loader/issues/442
return <AppContainer> return <AppContainer errorReporter={ErrorDebug}>
<Component {...props} url={url} /> <Component {...props} url={url} />
</AppContainer> </AppContainer>
} }

View file

@ -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, err: { name, message, module } }) => ( export default ({ error, error: { 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,7 +11,7 @@ export default ({ err, err: { name, message, module } }) => (
{ {
name === 'ModuleBuildError' name === 'ModuleBuildError'
? <pre style={styles.message} dangerouslySetInnerHTML={{ __html: ansiHTML(encodeHtml(message)) }} /> ? <pre style={styles.message} dangerouslySetInnerHTML={{ __html: ansiHTML(encodeHtml(message)) }} />
: <StackTrace error={err} /> : <StackTrace error={error} />
} }
</div> </div>
) )