PDA

View Full Version : [CLOSED] Javascript unhandled exception & program execution behavior



VSPL
Sep 12, 2015, 11:10 AM
Hi Ext.Net Team,
I have seen some cases in my application that sometime JavaScript unhandled exception is appearing in the console and then after my program misbehave after such events (these javascript unhandled exception is not belongs to my code), the cause of such unhandled exception may be due to user has pressed ESC key while Ext.NET was executing some of the direct events and the result is not fully received by the browser, also their could be other cases but this is what I am just guessing right now, but due to any unhandled javascript exception (which is not belong to my code) is there a way to handle all Javascript unhandled exception globally and then either do the following things:

1) Force the user to restart their browser and halt current program execution with some modal window.
2) Clear all unhandled JavaScript exceptions in the current browser session programmatically. And auto restart the logged-in user session (by redirecting to the login or to default home page automatically).

Please advise

Thanks

Daniil
Sep 12, 2015, 4:07 PM
Hi @VSPL,


is there a way to handle all Javascript unhandled exception globally

There is a window.onerror handler you could try with.
http://forums.ext.net/showthread.php?28179&p=125620&viewfull=1#post125620

A ResourceManager's AjaxRequestException listener might be helpful as well.
http://forums.ext.net/showthread.php?25048&p=110214&viewfull=1#post110214


1) Force the user to restart their browser and halt current program execution with some modal window.

It should not be a problem once you catch the error.


2) Clear all unhandled JavaScript exceptions in the current browser session programmatically.

I don't think that unhandled JavaScript exceptions are store anywhere. So, I don't think there is a way to clear it. Though, if a page is being refreshed or redirected then, I guess, it does the job that you need - it will start working as no error happened.


And auto restart the logged-in user session (by redirecting to the login or to default home page automatically).

Redirecting should not be a problem once you catch the error. This JavaScript code redirects:

window.location = "New URL";

VSPL
Sep 17, 2015, 4:04 AM
Hi Daniil,
I am doing the changes you suggested, will provide the feedback in few days, thanks for the support.