Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cross browser stacktrace #776

Merged
merged 2 commits into from
Jan 15, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions lib/error-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, stack, module } }) => (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope we are not using this stack variable. Let's remove it.

<div style={styles.errorDebug}>
<Head>
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
Expand All @@ -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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we may display name and message twice. Can you post the screenshot to see how it looks like ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure:

screen shot 2017-01-15 at 16 11 52

We would always display it twice in chrome, maybe we should add the word stacktrace: above the stacktrace.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On safari it would only be the pink'ish title and the trace without the 1 tab indent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good for now, tho we might want to remove duplicated name and message later.

<pre style={styles.message}>
{stack}
</pre>
</div>
)

const styles = {
errorDebug: {
background: '#a6004c',
Expand Down