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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:10:38+00:00 2026-05-11T17:10:38+00:00

Hello and thanks for your opinion. I am creating a webservice. This webservice will

  • 0

Hello and thanks for your opinion.

I am creating a webservice.
This webservice will accept a customer and the customers accounts along with a couple other related objects and attributes and such.

When the webservice recieves a request, I attempt to process it.
If there is no error I simply just return. If there is an error, I throw it.

I’m wondering if this is the best approach, or if I should modify my design so that I return a bool as the response, or even create a response object, that maybe contains the original request object plus a status and if error, a list of errors (ie: Missing Fields, Invalid Fields, ext).

Which return method would you incorporate in your design?
1) Just return if no error, Throw error if error
2) bool success
3) Response object (containing original request object? and detailed results)?

Thanks for any suggestions.
Steven

  • 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-11T17:10:38+00:00Added an answer on May 11, 2026 at 5:10 pm

    I would say that it depends on what the ‘error’ is. If the error is validation-related but expected in the normal course of events e.g invalid user credentials being passed to a service that provides user authentication, then returning an enum value that indicates the request result (Success, Failure, etc) is probably OK. However if the error is due to input that should not happen in the normal course of events, then I would suggest you throw a fault from the service operation. Throwing a fault indicates that the client app is in error and has provided input that the service does not know how to deal with. You can register particular fault contracts with a WCF service operation so a client app knows the operation may throw one of a number of faults under particular circumstances. The client app should provide exception handlers for these faults and take action if one is thrown, otherwise it will terminate unexpectedly.

    As a basic rule of thumb, I would say throw faults under exceptional circumstances e.g. where the client has provided input that the service operation does not expect to receive. If the client has provided information that is incorrect but the service operation is progammed to handle, return a status code or information in the response message.

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

Sidebar

Related Questions

Hello everyone and thanks for your help! I currently have this program that renames
Hello and thanks for your time, I am creating an application that moves video
Hello all and thanks for your time reading this. I need to verify certificates
This is my first question so hello and thanks for your support! I am
I have this kinda template text : Hello {#Name#}, Thanks for coming blah on
Hello guys and thanks for your help as always. I am stuck on Asp.NET
Hello and thanks for your time. Consider the following scaled down example of a
Hello and thanks for your help in advance. I am starting on the NHibernate
Hello all Thanks for your previous replies hey i am unable to install the
Hello all and thanks for your time. I believe I have a simple question.

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.