views:

84

answers:

4

How do you capture errors that happen on client side when building RIA apps using Flex and Silverlight? What are the common practices? I have seen some asynch js calls to a web service implemented but would like to know how the community is dealing with it.

A: 

In Silverlight I like to use a WebClient to log back to a web service somewhere -- you can do this directly in the Silverlight application without calling out to JavaScript.

To catch exceptions that are fired when your code isn't on the stack, you can use the Application.UnhandledException event.

Jesse Collins
+3  A: 

First, I use client side logging all of the times. the way I handle it depends on the entire application.

if I use an AMF gateway then there's a call for an application error, with every error that occurs the server is notified, in the server side a bug is open in BugZilla (this is what we use, you can use any other hook you want).

If I use a web-service based application then there's a web-service call for a client error.

one would say you shouldn't sample the server with every error, I disagree with this comment because an error in the client side is rare, it goes thorough QA before being released to the client so I want to know immediately on every error the client is experiencing.

Avi Tzurel
I like the idea of creating a JIRA issue out of the client error.
CodeToGlory
Sure thing, this way the client does not have to report an error, in the worst case scenario if he calls and says he had this error you can say "we are already on it".This is great customer service
Avi Tzurel
A: 

I've used the same approach as Avi Tzurel - you need to know on the server side when an error appeared in the Flex client. If you want to collect more data (all the log messages, warnings) I would use an internal buffer and I will flush it asynchronously.

Anyway, you need to take into consideration if your customers are ok with this approach..maybe you need their agreement before sending the error message to the server.

Cornel Creanga
A: 

I basically percolate all errors to the top, and capture them in the unhandled exception. I display a friendly message to the user. However, throughout my application I implement an ILogger interface. This interface can be initialized with various levels and handles any messaging. You can set it up so the user can add an init param to determine whether or not to transmit the errors to a service, and I typically have the logger write the messages with Debug.WriteLine if the debugger is attached to make it very easy to trace issues in debug mode.

Jeremy Likness