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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:44:54+00:00 2026-05-22T00:44:54+00:00

How to handle errors/exceptions returned by WCF servicer (REsTful) in Jquery ajax() method? Assuming

  • 0

How to handle errors/exceptions returned by WCF servicer (REsTful) in Jquery ajax()method?

Assuming I have includeExceptionDetailInFaults="true" turned on and I use

error: function(XMLHttpRequest, textStatus, errorThrown) {
        alert(XMLHttpRequest.responseText);
 }

only thing I get back is an HTML string (HTML page) with error buried deep inside it;;

I want to display errors like

  1. Service not found (HTTP 400 and 500
    errrors)
  2. .net exceptions thrown by WCF to the
    client page (javascript)

How can I do that?

  • 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-22T00:44:55+00:00Added an answer on May 22, 2026 at 12:44 am

    includeExceptionDetailsInFaults is more of a debugging tool for unhanded exceptions than a way to actually deliver errors to the client. These kinds of errors would normally be 500 internal server errors whose details should not be leaked out to the client any way. For a REST service the way to generically deliver these details to the caller by default is to return them as text/HTML.

    However, if you are trying to return logical errors out of your service you should be conjuring up instances of WebFaultException<T> where T can be a simple string message or, if you want something more complex, can be a class which will get serialized into a structured format according to whatever serialized is configured for your service endpoint. You are also able to set the response status code during the construction of the WebFaultException<T>.

    If you wanted generic handling of all unhandled exceptions to return a structured content type representation and status code you would need to write your own IErrorHandler and do the translation of the unhanded exception type to a WebFaultException<T> in your ProvideFault implementation.

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

Sidebar

Related Questions

This is related to my question on how to handle errors from jQuery AJAX
What's the best practice to handle errors if using objects? A) Before the method
When using jQuery 's ajax method to submit form data, what is the best
What are some good ways to handle known errors that occur in a method?
I want to use Oracle exception to handle errors that might happen in the
How can I correctly handle exceptions thrown from controllers in ASP.NET MVC? The HandleError
I've been doing some research on how to globally handle errors in my ASP.NET
In writing Win32 C++ code, I'd appreciate some hints on how to handle errors
I am trying to find out the best way of handling exceptions, I have
I'd like to encapsulate Win32 errors (those returned from GetLastError()) in some form of

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.