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 6120607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:41:15+00:00 2026-05-23T15:41:15+00:00

I am coding some kind of a WCF service. most exceptions are caught in

  • 0

I am coding some kind of a WCF service. most exceptions are caught in the BL implementation and handled there. Each of my API’s return type is a class (named – “result”) containing error code, error message and success boolean.

When exceptions are handled, this class is updated accordingly and in the end is sent back to the client.
Some of the exceptions are off-course, unhandled. Currently, I am wrapping each of my BL calls from the service layer with a generic try-catch so I can catch every unhandled exception and create a generic “result” class with a generic failure message, error code and success=false.

Is it a good way to handle exceptions or should I let unhandled exception to be thrown by the service to the client?
You can assume that the client can’t use the data from the exception so it won’t benefit from the extra information contained in the exception.

  • 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-05-23T15:41:16+00:00Added an answer on May 23, 2026 at 3:41 pm

    Check out Exception Shielding.

    This is a process where exceptions raised by the service, are mapped to fault contracts according to rules you specify in a configuration file. This saves a lot of donkey work with try/catch blocks.

    Here is one post to help you out:

    In general though – faults will fall into 3 categories:

    1) Client error – the client has tried to do something not permissable, so it needs to know about it. E.g. Failed to set a mandatory field. – Return specific message explaining fault.

    2) Business error that doesn’t affect the client. An error that is considered normal operation, e.g. Payment Authorization check failure. Either hide from client completely, or return some message: “Error performing request: Please try again later…”

    3) System error – Unexpected – not normal operation: Replace with generic message: “System Error: Call Support”

    In all cases though, the key thing is you remove the stack trace, especially if it’s a public facing service.

    With shielding you would have 3 Fault Contracts covering the above scenarios, and set the text appropriately in the Shielding configuration.

    Be advised, you generally want shielding turned off during development as it makes it a right pain to debug the system!

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

Sidebar

Related Questions

i'm coding some kind of objects browser, organized with folders. When user seslects some
Is there a way knowing (at coding time) which exceptions to expect when executing
Looking for some guidance on a wcf 4 rest service which is based on
Say you're coding some kind of web application. Something where people can contribute content,
Let's say I am tasked with coding some kind of an RPG. This means
I used program C, and now im doing some web coding, is there a
I am currently coding some chat program and now want to play music via
I've noticed in some coding people use icicle with the onCreate method, and I
I'm trying to save myself some coding time by taking advantage of using namespace
We are currently going through the long process of writing some coding standards for

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.