Exception Handling Error Message Localization

Topics: Exception Handling Application Block
May 17, 2007 at 4:02 AM
I've been unsuccessful in attempting to utilize the exceptionMessageResourceType and exceptionMessageResourceName configuration properties of the Wrap/Replace exception handlers to localize error messages. Can anyone help direct me in how to utilize these configuration properties? I've tried a number of differenct variations of specifying a resource file and a string within it, but it never affects anything.

The following verbage is what directed me to these properties...
"The Wrap and Replace exception handlers include additional configuration properties that allow you to specify exception messages in external resources instead of directly in the configuration file. This capability can be used to support localization of exception messages."

Thanks in advance for any help.
May 28, 2007 at 8:31 PM
Edited May 28, 2007 at 8:33 PM
<add exceptionMessage=""
exceptionMessageResourceName="MyErrorMessage"
exceptionMessageResourceType="MyCompany.MyProduct.BusinessLogic.Properties.Resources, MyProduct.BusinessLogic, Version=2.0.0.0, Culture=neutral, PublicKeyToken=3ab4da52d54689a2"
replaceExceptionType="System.ApplicationException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ReplaceHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
name="Replace Handler" />
Nov 29, 2007 at 10:24 AM
Thanks jcasal for your sample, it works fine but...
What if I'm coding a web application? How can I set exceptionMessageResourceType?

I've been trying many settings with no success so far!
May 8, 2009 at 9:02 AM

Hi,

My case is a little bit different, but I do not know how to enter the value for exceptionMessageResourceType and exceptionMessageResourceName:

Assembly Name: CompanyName.ProductName
NameSpace Name: CompanyName.ProductName.Messages
Resource File Location: CompanyName.ProductName.Messages.WarningMessages.resx

I want to use the resource file of the above assembly in my Windows application. I have no problem if I'm not using the exceptionMessageResourceType and exceptionMessageResourceName properties by leaving them blank and hard-coding the wrapped warning message into the ExceptionMessage property. I just do not know how to enter the value for exceptionMessageResourceType and exceptionMessageResourceName if I do not want to hard-code my warning message.

Please help. Thanks in advance!

Regards,
Antonio

 

May 8, 2009 at 11:41 AM

Hi,

In the exceptionMessageResourceName, It is the Name of the entry in your Resource. In the exceptionMessageResourceType, It is the full type name of your Resource, in your case I think it should be, "CompanyName.ProductName.Messages.WarningMessages, CompanyName.ProductName".

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com