• 0

JS error handling in edge problems


Question

Anyone do JS dev on edge? I have a site that is using extensive AJAX and JS / jQuery / etc

 

The site has a global error handler set up on window.onerror (only to catch unhandled exceptions and log them on the server via posting the error detail back as a json package) which works perfectly fine in IE11, Chrome, FF, Safari, but when I do the same exact thing in Edge, if the function executed in JS has an error its like the function just will not run. to test this I set up just a junk function and called it with a button press, <button onclick = "testfunc(this);"> pretty simple, put into that function some code that just says 

 

function testfunc(button) {

throw new Error('test');

}

 

simple right? In Chrome, IE11, Safari, FF I get my error handler with that error message...

 

in Edge, that function doesn't even start to execute... remove the throw new error and put in a junk call like foo(); which is an undefined function same result.... replace that with alert('hello?'); and boom executes.....

 

JS isn't my primary language (actually never used it much until recently, was primary a back-end coder before) so am I missing something, doing something wrong? what? Or is something different with the Edge JS engine?

Link to comment
https://www.neowin.net/forum/topic/1303094-js-error-handling-in-edge-problems/
Share on other sites

5 answers to this question

Recommended Posts

  • 0
On 7/18/2016 at 9:53 AM, neufuse said:

no one?

I setup the following code on a test.html page and ran it on IE Edge and the alert is showing up just fine for me - 

 

<script type="text/javaScript">

window.onerror = function(message, source, lineno, colno, error)
{
	alert(message + ": " + source + " : " + lineno + " : " + colno + ": " + error);
}

function testfunc(button) {
	throw new Error('test');
}
</script>

<button onclick="testfunc(this);">Test</button>

 

  • 0
On ‎7‎/‎24‎/‎2016 at 0:25 AM, svnO.o said:

I setup the following code on a test.html page and ran it on IE Edge and the alert is showing up just fine for me - 

 


<script type="text/javaScript">

window.onerror = function(message, source, lineno, colno, error)
{
	alert(message + ": " + source + " : " + lineno + " : " + colno + ": " + error);
}

function testfunc(button) {
	throw new Error('test');
}
</script>

<button onclick="testfunc(this);">Test</button>

 

copied and pasted that into a local html file..... same problem..... testfunc will not execute *scratches head* maybe it's the build I'm on

  • 0
1 hour ago, neufuse said:

copied and pasted that into a local html file..... same problem..... testfunc will not execute *scratches head* maybe it's the build I'm on

If it helps, I tested on Edge 25.10586.0.0 / EdgeHTML 13.10586 - other than that maybe some odd browser setting? I'd not worry too much though if its working in the other browsers as well as in the Edge browser version I tried.

  • 0
8 hours ago, svnO.o said:

If it helps, I tested on Edge 25.10586.0.0 / EdgeHTML 13.10586 - other than that maybe some odd browser setting? I'd not worry too much though if its working in the other browsers as well as in the Edge browser version I tried.

I just find it odd that the function wont even enter... I could put an alert('test'); before the throw new error and set a break point on it, never enters...

 

remove the throw new error do the same thing and boom alert executes... just very odd, you would think it would at least enter the function

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Lilly Livered American Media Are Scared
    • Really? Despite the memory price rises, nothing can kill it? I thought something would.
    • I think there will be a 27H1 for actual users of 26H1 The 25h2 supports ARM too : Snapdragon X, Snapdragon X Plus and Snapdragon X Elite
    • Poll: Grand Theft Auto VI price predictions, cast your vote by Pulasthi Ariyasinghe After years of waiting, Rockstar will be solidifying the launch date of Grand Theft Auto VI with the launch of pre-orders next week. While the studio has confirmed a date for this occasion, it is yet to attach a price to the highly anticipated game. So let's see what our readers think it will cost at launch. The Grand Theft Auto VI pre-orders will kick off on June 25 for digital and physical editions. Unless some last-minute changes happen, the release date will be November 19, 2026, across Xbox Series X|S and PlayStation 5. Unfortunately, there's still no information about a PC version from the developer or the publisher Take-Two. Now the question becomes, how much will Grand Theft Auto VI cost at launch? The game is predicted by some analysts to be the biggest launch of an entertainment product ever. With the amount of hype that has been built behind it and with ballooning development costs, Take-Two may price this Grand Theft Auto entry differently from other AAA titles. The current price of a AAA game is $69.99. That norm almost rose to $79.99 before calming down. But with such a massive release, Grand Theft Auto VI may be the game that pushes the boundary again. It's also possible that Take-Two keeps the price relatively low to increase the number of players that jump in early and keep them hooked on Grand Theft Auto Online to spend on microtransactions for years to come. Keep in mind that the below poll is asking for a prediction of the standard edition price, not a deluxe or any other special edition that Take-Two will introduce for additional benefits. Also, there is the chance of the company splitting up the campaign and online portions. If you think that will happen, put your vote on what you think will be the total cost of the two. Poll Poll: How much will Grand Theft Auto VI cost? $59.99 $69.99 $79.99 $89.99 $100 or more Submit Vote If you have a very specific prediction in mind, sound off in the comments below.
  • Recent Achievements

    • One Year In
      hhgygy earned a badge
      One Year In
    • One Month Later
      AMV earned a badge
      One Month Later
    • Week One Done
      AMV earned a badge
      Week One Done
    • Collaborator
      ryansurfer98 went up a rank
      Collaborator
    • One Month Later
      Eurosoft10 earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      513
    2. 2
      +Edouard
      171
    3. 3
      PsYcHoKiLLa
      82
    4. 4
      Steven P.
      74
    5. 5
      Michael Scrip
      72
  • Tell a friend

    Love Neowin? Tell a friend!