Need help with ExceptionMessageResourceName property in ReplaceHandler

Topics: Building and extending application blocks, Exception Handling Application Block, General discussion
Apr 2, 2008 at 12:55 AM

I'm using the 'ExceptionMessageResourceName' property in Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ReplaceHandler to specify a Resource Id. The problem I'm facing is that most of my resource strings contain placeholders for parameters. Ex: "Error occurred in Server: {0} Database: {1}". Is there a way I can pass parameters to it?

Any help will be appreciated.

Apr 2, 2008 at 6:21 PM
Hi Percy,

Unfortunately, no. You can however create your own handlers that would look for the parameters and perform the formatting. This post from Tom shows how to do something similar

I'm curious about how you would get the replacements anyway. Would those be properties on the handled exception, or would they have to be extracted from the exception messages?