• 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 18/07/2016 at 14:53, neufuse said:

no one?

Expand  

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 24/07/2016 at 04:25, 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>

 

Expand  

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
  On 26/07/2016 at 02:23, 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

Expand  

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
  On 26/07/2016 at 04:15, 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.

Expand  

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

    • Rustdesk. https://rustdesk.com/ You can even set up your own relay server (if you desire).
    • ICYMI: 4TB Corsair MP700 PRO SE SSD is still selling at its lowest price by Fiza Ali Amazon US and Newegg are still offering the 4TB Corsair MP700 PRO SE solid-state drive at its new lowest price. The MP700 PRO SE is an M.2 2280 SSD that employs a PCIe 5.0 ×4 interface with NVMe 2.0, delivering sequential read speeds of up to 14,000MB/s and sequential write speeds of up to 12,000MB/s. It uses high-density 3D TLC NAND and carries a Total Bytes Written (TBW) rating of 3000. Furthermore, the drive can withstand vibration from 20Hz to 80Hz at 1.52mm and 80Hz to 2000Hz at 20G, as well as shocks up to 1500G. The drive incorporates AES 256-bit encryption and supports Microsoft DirectStorage, allowing compatible games to load assets directly to the GPU for reduced load times. Moreover, it operates within a temperature range of 0°C to +70°C, and can be stored between –40°C and +85°C at up to 93% relative humidity (40 °C). A heatsink is not included, so users must provide their own or rely on a motherboard’s integrated SSD cooling solution to maintain optimal thermals. Finally, the MP700 PRO SE is compatible with Windows 10, Windows 11, and macOS systems that provide an M.2 slot, and communicates via a standard M.2 2280 interface connector. 4TB Corsair MP700 PRO SE SSD: $549.99 (Amazon US) 12% off - $549.99 (Newegg) 9% off This Amazon deal is US-specific and not available in other regions unless specified. If you don't like it or want to look at more options, check out the Amazon US deals page here. Get Prime (SNAP), Prime Video, Audible Plus or Kindle / Music Unlimited. Free for 30 days. You can also check out other SSD deals here. For hard disk drives, you can head over to our HDD deals section to see if anything from there matches your requirements. Make sure you also browse through Amazon US, Amazon UK, and Newegg US to find some other great tech deals. As an Amazon Associate, we earn from qualifying purchases.
    • "requiring individual licences from all rights-holders would impose an unmanageable administrative burden and could deter AI investment in the UK." Ah so plebs (humans) will forever be required to secure license, but AI should get a broad pass because it's too complicated. Not so "intelligent" after all? Plus, every opt out I have signed regarding Meta using my data was never presented to me in a clear way, I had to discover it here on neowin or some other news site with a link to do it. So what the government is saying is that they prefer to offer an opt out just to cover their asses, but good luck us plebs finding such a thing!
    • The look speaks volumes, doesn't it?  
  • Recent Achievements

    • First Post
      ClarkB earned a badge
      First Post
    • Week One Done
      Epaminombas earned a badge
      Week One Done
    • Week One Done
      Prestige Podiatry Care earned a badge
      Week One Done
    • Week One Done
      rollconults earned a badge
      Week One Done
    • Week One Done
      lilred1938 earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      136
    2. 2
      Xenon
      129
    3. 3
      ATLien_0
      123
    4. 4
      +Edouard
      102
    5. 5
      snowy owl
      96
  • Tell a friend

    Love Neowin? Tell a friend!