Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8374679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:58:30+00:00 2026-06-09T14:58:30+00:00

Enterprise Library 5.0 Exception Handling includes the Wrap Handler. This wraps an exception in

  • 0

Enterprise Library 5.0 Exception Handling includes the Wrap Handler. This wraps an exception in another exception and throws the wrapper exception.

I would like to add additional information to my wrapper exception, such as some information about the parameters and settings that were in effect when the error occurred. This would be handy for troubleshooting (since this wrapper exception will be caught and logged by a higher-level handler).

I was using the following code:

ExceptionManager em = EnterpriseLibraryContainer.Current.GetInstance<ExceptionManager>();
em.Process(() => { DoSomething(); }, "WrapPolicy");

The result of this is an exception that gets wrapped in my custom exception and thrown. This is clean and easy, but since my code never sees the wrapper exception instance, I can’t augment it with additional information.

Other than wrapping the action in a traditional Try…Catch and executing the HandleException method manually, is there a way to inject additional information into the wrapper exception instance?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:58:32+00:00Added an answer on June 9, 2026 at 2:58 pm

    I’m not sure what kind of additional information you want to add but if you want to maintain the elegance of the Process method then you could create a custom WrapHandler that adds the appropriate information to the wrapper exception. A good candidate would be to add the additional information to the Exception.Data IDictionary.

    If you are looking for method arguments then probably the only way to do it would be by creating your own “context”, setting values in there, and extracting them from the context to add to the wrapping exception.

    Another more elegant approach would be to use Policy Injection. Call handlers have access to the method parameters as well as the exception thrown. You could modify the existing ExceptionCallHandler to add your information to the original or new exception. If you add the context information to the original exception then that information would be processed by the Exception Policy (which could include logging).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm implementing the Enterprise Library Exception Handling Application Block in an ASP.NET application that
I'm using the Enterprise Library Exception handling block in an ASP.NET web application. I
I've got a WCF service that's using Enterprise Library for its Exception Handling and
I am using Enterprise Library 4.x for my exception handling logging (ASP.NET application). Here
Using .NET 3.5, ASP.NET, Enterprise Library 4.1 Exception Handling and Logging blocks, I wrote
I m using Microsoft Enterprise Library 3.1 for Exception Handling in asp.net, the erors
We're using Enterprise Library 4.1 for logging (and exception handling/cryptography). Does anyone know a
I am using the enterprise library logging and exception handling . Currently I am
I'm just starting to use the Enterprise Library Exception Handling block. It seems a
So, we are using the Enterprise Library 4.1 Exception Handling Application Block to deal

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.