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

Cross-origin error handling in DEV #10353

Merged
merged 17 commits into from
Aug 3, 2017
Merged

Commits on Aug 1, 2017

  1. Configuration menu
    Copy the full SHA
    01e2470 View commit details
    Browse the repository at this point in the history

Commits on Aug 2, 2017

  1. Use a custom error object in place of cross-origin errors

    Cross-origin errors aren't accessible by React in DEV mode because we
    catch errors using a global error handler, in order to preserve the
    "Pause on exceptions" behavior of the DevTools. When this happens, we
    should use a custom error object that explains what happened.
    
    For uncaught errors, the actual error message is logged to the console
    by the browser, so React should skip logging the message again.
    acdlite committed Aug 2, 2017
    Configuration menu
    Copy the full SHA
    cb6fd8c View commit details
    Browse the repository at this point in the history

Commits on Aug 3, 2017

  1. Configuration menu
    Copy the full SHA
    6f6425b View commit details
    Browse the repository at this point in the history
  2. Don't double log error messages in DEV

    In DEV, the browser always logs errors thrown inside React components,
    even if the originating update is wrapped in a try-catch, because of the
    dispatchEvent trick used by invokeGuardedCallback. So the error logger
    should not log the message again.
    acdlite committed Aug 3, 2017
    Configuration menu
    Copy the full SHA
    b145a08 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    af46b61 View commit details
    Browse the repository at this point in the history
  4. Fix tests

    gaearon committed Aug 3, 2017
    Configuration menu
    Copy the full SHA
    26770b2 View commit details
    Browse the repository at this point in the history
  5. Change how error is printed in DEV and PROD

    In DEV, we don't want to print the stack trace because the browser already always prints it.
    We'll just print the component stack now.
    
    In PROD, we used to omit the JS error message. However we *do* want to show it because
    if the application swallows the error, the browser will *not* print it. In DEV it works
    only because of the fake event trick. So in PROD we will always print the underlying error
    by logging the error object directly. This will show both the message and the JS stack.
    gaearon committed Aug 3, 2017
    Configuration menu
    Copy the full SHA
    fde39dc View commit details
    Browse the repository at this point in the history
  6. Make the wording tighter and emphasize the real error is above

    There's a few goals in the rewording:
    
    * Make it tighter using line breaks between sentences.
    * Make it slightly less patronizing ("You should fix it" => "You can find its details in an earlier log")
    * ^^ This also helps highlight that the real error message and stack is above
    * Group subsections: intro (there's an error), component stack, and final addendum about error boundaries
    * ^^ Otherwise people might think error boundaries are part of the reason they have an error
    * Make it clear "located at" is not the stacktrace. Otherwise it feels confusing. This makes it clearer you should still look for stack trace (with other details) above and introduces the concept of component stack.
    gaearon committed Aug 3, 2017
    Configuration menu
    Copy the full SHA
    fa20c9c View commit details
    Browse the repository at this point in the history
  7. Make the message shorter

    gaearon committed Aug 3, 2017
    Configuration menu
    Copy the full SHA
    095e29b View commit details
    Browse the repository at this point in the history
  8. Unused variables

    gaearon committed Aug 3, 2017
    Configuration menu
    Copy the full SHA
    8b183b5 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    39dea7e View commit details
    Browse the repository at this point in the history
  10. One more bikeshed

    gaearon committed Aug 3, 2017
    Configuration menu
    Copy the full SHA
    3364def View commit details
    Browse the repository at this point in the history
  11. Fix fixture

    gaearon committed Aug 3, 2017
    Configuration menu
    Copy the full SHA
    d99b90d View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    311a3f8 View commit details
    Browse the repository at this point in the history
  13. Remove unused file

    gaearon committed Aug 3, 2017
    Configuration menu
    Copy the full SHA
    9a8b033 View commit details
    Browse the repository at this point in the history
  14. Concise wording

    gaearon committed Aug 3, 2017
    Configuration menu
    Copy the full SHA
    39df724 View commit details
    Browse the repository at this point in the history
  15. Unused variables

    gaearon committed Aug 3, 2017
    Configuration menu
    Copy the full SHA
    2ea6063 View commit details
    Browse the repository at this point in the history