question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug in example : with-componentdidcatch

See original GitHub issue
  • I have searched the issues of this repository and believe that this is not a duplicate.

Hi,

I tried this example : with-componentdidcatch

Basically, it’s using componentDidCatch in the new _app.js. It intercepts the errors and does a console.log when it intercepts one :

https://github.com/zeit/next.js/blob/02bcfb21c81bbc0f76ec8af22d4197952bd9bc15/examples/with-componentdidcatch/pages/_app.js#L3-L9

Expected Behavior

  • I see CUSTOM ERROR HANDLING in the server logs

Current Behavior

  • I don’t see CUSTOM ERROR HANDLING in the logs
    • it’s not in server logs
    • it’s not in client logs

Steps to Reproduce (for bugs)

npx create-next-app --example with-componentdidcatch with-componentdidcatch-app
cd with-componentdidcatch-app
yarn dev

Context

The bigger picture here is trying to use error boundaries with next.js.

Your Environment

Tech Version
next 6.0.0
node 9.8.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

7reactions
garrettmaccommented, Dec 21, 2018

What is this line doing?

super.componentDidCatch(error, errorInfo) 
1reaction
sebas5384commented, Jul 20, 2018

@timneutkens @lucleray any news on this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Boundaries - React
A class component becomes an error boundary if it defines either (or both) of the lifecycle methods static getDerivedStateFromError() or componentDidCatch() ...
Read more >
Bug-proofing our application with Error Boundaries and the ...
The concept of Error Boundaries can be a great help in achieving that. It is a component that uses the componentDidCatch lifecycle method,...
Read more >
Catching Errors in React with Error Boundaries
componentDidCatch(error, errorInfo). This method is called whenever an error occurs. You can log the error (and any extra information) to your ...
Read more >
React error handling with react-error-boundary - LogRocket Blog
A componentDidCatch lifecycle method for performing operations when our error boundaries catch an error, such as logging to an error logging ...
Read more >
what's the difference between getDerivedStateFromError and ...
the doc has this sentence: Use static getDerivedStateFromError() to render a fallback UI after an error has been thrown. Use componentDidCatch() ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found