React: Error line number in Error Boundary

Created on 24 Oct 2018  路  14Comments  路  Source: facebook/react

Hey,

As I can not reopen issue #13790, I opened this.

If you don't like to fix/add my request, simply say won't fox, but don't close the issue with simple/not related answer, as @aweary did. React is pro library, you are pro, so act like pros.

Thanks.

Needs More Information

Most helpful comment

@gaearon any update? do you need more info?

All 14 comments

It's not clear what you're asking. Is error.stack not what you want?

@gaearon The error.stack is good, but the problem is all details doesn't point to right file(s).

For example:

componentDidCatch(error, info) {
    this.setState({ hasError: true });

    console.log("-----------------------------");
    console.log(error, info);
    console.log("-----------------------------");
}

I got this:
untitled

As you can see all details/line numbers point to bundled file (_in my case react.modules.js_).

Browser's console point to right file (and line number):
2

All I'm looking for is I can see home.jsx 12:14 into browser UI, like great react-error-overlay.

P.S: I tired to use react-error-overlay outside of create-react-app and I did it. but I think adding this to Error Boundary is great.

+1

@gaearon any update? do you need more info?

+1

+1

@dehghani-mehdi this information is only available when providing a sourcemap to the browser via your compiler (I assume webpack). You will not be able to access this information on a production site, as no sourcemap is provided when compiling for production.

See this:
https://what-problem-does-it-solve.com/webpack/sourcemaps.html

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution.

I'll provided requested info, is there anything else you want me to do?!

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any additional information, please include with in your comment!

.

Ok I found out I can get error line and info from error.stack I hope this help someone

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

.

Was this page helpful?
0 / 5 - 0 ratings