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

More precise information about JS errors in 3rd party code - possible? #22

Open
dandv opened this Issue Jul 14, 2015 · 5 comments

Comments

Projects
None yet
4 participants
@dandv
Copy link

dandv commented Jul 14, 2015

I have an error in a 3rd party library, that looks like this in Chrome:

image

In Loggly it looks like this:

image

Not exactly useful.

Is this possible? LogEntries doesn't seem to be able to offer better result either.

@dandv

This comment has been minimized.

Copy link
Author

dandv commented Jul 14, 2015

Apparently window.onerror doesn't return that information, unless CORS is set up properly, which wasn't the case in my setup, judging by the fact that a naive onerror handler gets "Script error" and 0.

Yet there must be a way to do this because Rollbar manages to somehow get file and line information:

image

What's going on above:

  1. Ensure Rollbar is installed
  2. Produce the error by clicking on an SVG on the page
  3. Add a simple onerror handler that just logs the message, file and line
  4. Trigger the error. Note that full information is available.
  5. Remove rollbar code from the page and reload.
  6. Re-add the simple onerror handler.
  7. Trigger the error. Notice how the error handler only gets Script and 0.

Therefore, Rollbar managed to catch the error from the 3rd party script.

@mostlyjason

This comment has been minimized.

Copy link
Contributor

mostlyjason commented Jul 20, 2015

Interesting, any idea how Rollbar does this? Seems like a useful addition.

@dandv

This comment has been minimized.

Copy link
Author

dandv commented Jul 20, 2015

They've shared :)

@varshneyjayant

This comment has been minimized.

Copy link
Contributor

varshneyjayant commented Jul 23, 2015

@dandv try to test this one after hosting your webpage on a server. It gives the script error when you runs the webpage from filesystem as browser does not allow your script to read the actual error message.

@iamtchelo

This comment has been minimized.

Copy link

iamtchelo commented Jan 24, 2017

@dandv you can add a crossorigin attribute in src tag. You'll be to be able to gets the exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.