Exception handling...

Jun 10, 2010 at 10:49 AM
Hi Marlon,
Struggling with how to show Exceptions to the user in a good way. I have created a ExceptionService that I can supply a Logger and LocalizationService (my LoggerService and LocalizationService) to log the exception but how do I show a user friendly message to the user if a system error occurred or other exceptions?

My solution that I started with is to handle all exceptions in the ViewModels, so in the catch I just do like this:

try
{
throw new ApplicationException("This is an Application exception");
}
catch (Exception exception)
{
ExceptionService.HandleException(exception, LocalizationService["TestExceptionMessage"]);
// How to show/send user friendly message LocalizationService["TestExceptionMessage"] to the View????
}

Suggestions??

Best regards,

Patrik Cedendahl,
System Developer
Sandvik IT Services AB
SE-811 81 Sandviken, SWEDEN

Office Phone: +46 26 262997
Mobile: +46 70 2728110
http://www.sandvik.com
patrik.cedendahl@sandvik.com

This e-mail is confidential and it is intended only for the addressees. Any review, dissemination, distribution, or copying of this message by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error, kindly notify us immediately by telephone or e-mail and delete the message from your system. The sender does not accept liability for any errors or omissions in the contents of this message which may arise as a result of the e-mail transmission.

Coordinator
Jun 10, 2010 at 9:29 PM
how do you want to show the exception in the UI?

is it a message box? is it some sort of notifier?

The way I did it in the past was to have a Error Notifier View and a VM for it. Then when an exception happens I send a message with the Mediator and the VM for the Error Notifier View would receive the message and render the exception.

I should do a sample with this...

Regards
Marlon
WPF Blog - http://marlongrech.wordpress.com/
Microsoft MVP for Client App



On Thu, Jun 10, 2010 at 10:50 AM, pcedendahl <notifications@codeplex.com> wrote:

From: pcedendahl

Hi Marlon,
Struggling with how to show Exceptions to the user in a good way. I have created a ExceptionService that I can supply a Logger and LocalizationService (my LoggerService and LocalizationService) to log the exception but how do I show a user friendly message to the user if a system error occurred or other exceptions?

My solution that I started with is to handle all exceptions in the ViewModels, so in the catch I just do like this:

try
{
throw new ApplicationException("This is an Application exception");
}
catch (Exception exception)
{
ExceptionService.HandleException(exception, LocalizationService["TestExceptionMessage"]);
// How to show/send user friendly message LocalizationService["TestExceptionMessage"] to the View????
}

Suggestions??

Best regards,

Patrik Cedendahl,
System Developer
Sandvik IT Services AB
SE-811 81 Sandviken, SWEDEN

Office Phone: +46 26 262997
Mobile: +46 70 2728110
http://www.sandvik.com
patrik.cedendahl@sandvik.com

This e-mail is confidential and it is intended only for the addressees. Any review, dissemination, distribution, or copying of this message by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error, kindly notify us immediately by telephone or e-mail and delete the message from your system. The sender does not accept liability for any errors or omissions in the contents of this message which may arise as a result of the e-mail transmission.

Read the full discussion online.

To add a post to this discussion, reply to this email (MEFedMVVM@discussions.codeplex.com)

To start a new discussion for this project, email MEFedMVVM@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com