views:

69

answers:

1

I posted for some help over here: http://stackoverflow.com/questions/2945925/

I have added an 'override OnError' in a common base class from all my pages, and can confirm that it works properly by putting a breakpoint within the function. However, I still get an exception propagating to the client, no matter what I do. Here is my issue: 1) I have a Telerik Grid control that is updated based on the value of a ComboBox. If an exception occurs and I catch it in a try/catch block then everything is fine. 2) If I get an exception when the ComboBox is changed but there is NO use of a try/catch block, then the error is caught in OnError. However, now I get a PageRequestManagerServerErrorException error just popping up in the client Ajax response (Javacript).

Any help?

+1  A: 

Hey,

There could be many reasons why it's happening. For one, it could be something with client-side rendering that's causing it, or it could be an AJAX request from an update panel or the RadAjaxPanel... one way to possibly tell is to tap into the Sys.WebForms.PageRequestManager's endRequest event, which is discussed briefly here: http://encosia.com/2007/07/18/how-to-improve-aspnet-ajax-error-handling/

So the error is possibly not happening around that area of code that has the try/catch block, but could be caused from something internal in the Telerik processes...

Could you share any code/markup?

Thanks.

Brian
Great, the PageRequestManager in JS works!!I'm a bit confused now:1) I notice that my OnError causes the exception in the JS to be different, whereas the exception is properly shown in the client if I use Page_Error. I must use either OnError or Page_Error to log errors to a file, but why does OnError change the exception.2) I notice that get_error().message in the JS also includes the name of the Exception type. This is a bit ugly in errors displayed to the client. I don't see any method that excludes the Exception Type. Is the only way to write custom JS to remove the unnecessary text?
Shaun_web
1) I would be suprised to see a difference; Page_Error is the event handler, whereas OnError is simply the method that does the event throwing... You are still calling base.OnError(e); in it? 2) string parsing; either with the MS ajax framework or JQuery or something. MS AJAX has a String.StartsWith method that you can use to check for certain errors, and then substring or substr to remove the text.. I know, a little clunky... maybe regular expressions could help here actually...
Brian