# JavaScript Error Reports - missing source, line and column number

**URL:** <https://meta.discourse.org/t/javascript-error-reports-missing-source-line-and-column-number/24115>\
**Category:** Bug\
**Tags:** rest-api\
**Created:** [January 17, 2015, 1:12am UTC](https://meta.discourse.org/t/javascript-error-reports-missing-source-line-and-column-number/24115 "2015-01-17T01:12:07Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![DeanMarkTaylor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/deanmarktaylor/32/102462_2.png) [@DeanMarkTaylor](https://meta.discourse.org/u/DeanMarkTaylor)\
**Post date:** [January 19, 2015, 3:38am UTC](https://meta.discourse.org/t/javascript-error-reports-missing-source-line-and-column-number/24115/8 "2015-01-19T03:38:04Z")

</div>

I believe I have found the cause of these error reports missing line numbers.

I could be wrong - but I thought I would share as I currently I debugging in production and source and line numbers are off a bit…

Not quite the root cause - but I can cause it in Google Chrome 39 dependably.

I believe that when an AJAX call fails for whatever reason we are seeing these JavaScript errors with no source, line number or column number.

###Steps to reproduce

1. Set Discourse instance to “Read-Only” mode
2. Open Chrome to topic page
3. Open debug console Ctrl + Shift + i
4. Copy this line onto clipboard  
`window.onerror = function(m, u, l, c, errorObj) { console.log(m, u, l, c, errorObj, errorObj.stack); }`
5. Refresh page
6. Wait for page to load
7. As soon as it seems complete Paste and Execute the line copied to the clipboard.

Note that all we have really done here is replace this function:

> <https://github.com/discourse/logster/blob/bbd1a7ae11ad10c7961092eb085439dbeab79e0b/vendor/assets/javascripts/logster.js.erb#L10>

With one that will allow Chrome to help us find the source of the error.  
And if you were using un-minified sources you could just as easy use `window.onerror = null` to get better debugging in Chrome.

###Expected Output  
Lines to be output including line numbers

###Actual Output

```
 undefined null null null Object {readyState: 4, getResponseHeader: function, getAllResponseHeaders: undefined

```

**Note the source, line and column numbers are null.**

###explanation

Note that the object output is from the Timing call here:

> <https://github.com/discourse/discourse/blob/f66c39c63bfa57318f742b672b02a02ab18b68a3/app/assets/javascripts/discourse/lib/screen_track.js#L123>

Using the Ajax call here:

> <https://github.com/discourse/discourse/blob/271374a8c62b247d826f8bdfc648da8f36dc8618/app/assets/javascripts/discourse/mixins/ajax.js#L43>

So to repeat:  
**I believe that when an AJAX call fails for whatever reason we are seeing these JavaScript errors with no source, line number or column number.**

I’m not just thinking the timing AJAX calls have this issue - perhaps others do too?

**Until this is proven true or false I believe suppression is perhaps the wrong thing to do and perhaps indicative of an actual problem existing.**

Feel free to call me crazy, slap me about and tell me I’m wrong.

---

_[View the full topic](https://meta.discourse.org/t/javascript-error-reports-missing-source-line-and-column-number/24115)._
