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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:36:08+00:00 2026-05-13T08:36:08+00:00

I am using WCF RIA Services VS2008/.NET 3.5 and trying to do exception handling.

  • 0

I am using WCF RIA Services VS2008/.NET 3.5 and trying to do exception handling. I have overridden OnError method of DomainService and doing my exception handling in that method. I am trying to throw Business Rule Exceptions or Database Exceptions to client in some form so that client recognizes them and handles them differently.
The problem is that client always receives DomainServiceException and the original error message with First line showing the operation name failed. So, there’s no way I can identify the exception type on client side. I tried adding a special string to certain kind of exceptions in OnError as below

   /// <summary>
    /// Exception handling and logging on error
    /// </summary>
    /// <param name="errorInfo"></param>
    protected override void OnError(DomainServiceErrorInfo errorInfo)
    {
        Exception exceptionToLog = null;
        //if exception is business rule exception then log only if there's an inner exception
        if (errorInfo.Error.GetType() == typeof(BusinessRuleException))
        {
            if (errorInfo.Error.InnerException != null)
            {
                exceptionToLog = errorInfo.Error;
            }
            //send the business rule exception to client
            base.OnError(new DomainServiceErrorInfo(new DomainException("BRE:" + errorInfo.Error.Message)));
        }
        else
        {
            exceptionToLog = errorInfo.Error;
            //if its some other server error then send only generic message.
            base.OnError(new DomainServiceErrorInfo(new DomainException(ValidationErrorResources.MSG_GenericServerError)));
        }

        if (exceptionToLog != null)
        {
            //log exception
            EntLibHelper.LogError(exceptionToLog);
        }
    }

But this trick does not seem to be working.
Is there any way I can attach some extra information, to the exception I am throwing from the server to the client.
Please suggest.

  • 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-13T08:36:09+00:00Added an answer on May 13, 2026 at 8:36 am

    In the RTM update you’ll be able to set the Error property on DomainServiceErrorInfo you want to send back to the client. At that point, you can set it to an instance of a DomainException.

    You might be able to get similar behavior by throwing a new DomainException from your OnError, though that would be a hacky workaround (assuming it works).

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

Sidebar

Related Questions

I'm using WCF RIA Services and I have a domain service method that returns
I have a Silverlight 3 app using WCF RIA Services and Entity Framework for
I'm doing unit testing for our WCF RIA services, which have RequiresRole or RequiresAuthentication
Hi i am using WCF RIA services class in Silverlight. I do have a
Hello guys im using WCF RIA Services i have domain services where i wrote
I am working with WCF RIA services and have come across a sample using
I am using SL 4, WCF RIA Services against Entity Framework 4.0. I have
Using WCF RIA Services, how is it possible to determine if a record is
I am using WCF RIA services with silverlight. Obviously I am using this primarily
In a Silverlight 4 proj i'm using WCF RIA services, MVVM principles and EF

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.