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

Handle string only errors in RedBox.js #55

Merged
merged 1 commit into from
Apr 29, 2017

Conversation

petetnt
Copy link
Contributor

@petetnt petetnt commented Apr 29, 2017

This PR fixes #50 by handling string only errors in RedBox.js. If the encountered error is a string, the RedBox.js will render the error in a generic way as early as possible.

In #50 the error was raised by a third party module chroma.js, which only throws strings in the errors (which is sadly relatively common, I guess).

Before:
image

After:
image

Signed-off-by: petetnt pete.a.nykanen@gmail.com

Signed-off-by: petetnt <pete.a.nykanen@gmail.com>
@@ -17,7 +17,7 @@ type StackFrame = {
functionName?: string,
source?: string,
args?: any[],
evalOrigin?: StackFrame,
evalOrigin?: StackFrame
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prettier strips the trailing comma from here 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like eslint doesn't catch dangling commas in types — cc @ljharb

Copy link
Collaborator

Choose a reason for hiding this comment

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

It wouldn't; eslint (and the airbnb style guide) doesn't support flow. If you're using Flow, you'd need a separate flow-specific eslint config.

@jemgold
Copy link
Contributor

jemgold commented Apr 29, 2017

Nice work, thanks @petetnt :)

@jemgold jemgold merged commit 7a10dcd into airbnb:master Apr 29, 2017
@petetnt petetnt deleted the handle-string-only-errors branch May 1, 2017 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid prop error of type String supplied to RedBox
3 participants