How to specify allowed exceptions in WCF's configuration file?
I´m building a set of WCF services for internal use through all our applications. For exception handling I created a default fault class so I can return treated message to the caller if its the case or a generic one when I have no clue what happened.

Fault contract:

<pre><code>
    [DataContract(Name = "DefaultFault", Namespace = "http://fnac.com.br/api/2010/03")]
    public class DefaultFault
    {           
        public DefaultFault(DefaultFaultItem[] items)
        {
            if (items == null || items.Length== 0)
            {
                throw new ArgumentNullException("items");
            }
            
            StringBuilder sbItems = new StringBuilder();

            for (int i = 0; i < items.Length; i++)
            {
                sbItems.AppendLine(items[i].ToString());
            }

            _message = sbItems.ToString();        
        }

        private DefaultFaultItem[] _items;
        
        [DataMember(Name="Items")]
        public DefaultFaultItem[] Items
        {
            get
            {
                return _items;
            }
        }
        
        [DataMember(Name="Message")]
        private string _message;
        public string Message
        {
            get
            {
                return _message;
            }
        }
    }
</code></pre>

Specifying that my method can throw this exception so the consuming client will be aware of it:

<pre><code>
        [OperationContract(Name = "PlaceOrder")]
        [FaultContract(typeof(DefaultFault))]
        [WebInvoke(UriTemplate = "/orders", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, Method = "POST")]
        string PlaceOrder(Order newOrder);
</code></pre>

Most of time we will use just .NET to .NET communication with usual binds and everything works fine since we are talking the same language. However, as you can see in the service contract declaration I have a WebInvoke attribute (and a webHttp binding) in order to be able to also talk JSON since one of our apps will be built for iPhone and this guy will talk JSON.

My problem is that whenever I throw a FaultException<DefaultFault> and have includeExceptionDetails="false" in the config file the calling client will get a generic HTTP error instead of my custom message. 

I understand that this is the correct behavior when includeExceptionDetails is turned off, but I think I saw some configuration a long time ago to allow some exceptions/faults to pass through the service boundaries. 

Is there such thing like this? If not, what do u suggest for my case?

Thanks a LOT!
How to specify allowed exceptions in WCF's configuration file?
===

I´m building a set of WCF services for internal use through all our applications. For exception handling I created a default fault class so I can return treated message to the caller if its the case or a generic one when I have no clue what happened.

Fault contract:

<pre><code>
    [DataContract(Name = "DefaultFault", Namespace = "http://fnac.com.br/api/2010/03")]
    public class DefaultFault
    {           
        public DefaultFault(DefaultFaultItem[] items)
        {
            if (items == null || items.Length== 0)
            {
                throw new ArgumentNullException("items");
            }
            
            StringBuilder sbItems = new StringBuilder();

            for (int i = 0; i < items.Length; i++)
            {
                sbItems.AppendLine(items[i].ToString());
            }

            _message = sbItems.ToString();        
        }

        private DefaultFaultItem[] _items;
        
        [DataMember(Name="Items")]
        public DefaultFaultItem[] Items
        {
            get
            {
                return _items;
            }
        }
        
        [DataMember(Name="Message")]
        private string _message;
        public string Message
        {
            get
            {
                return _message;
            }
        }
    }
</code></pre>

Specifying that my method can throw this exception so the consuming client will be aware of it:

<pre><code>
        [OperationContract(Name = "PlaceOrder")]
        [FaultContract(typeof(DefaultFault))]
        [WebInvoke(UriTemplate = "/orders", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, Method = "POST")]
        string PlaceOrder(Order newOrder);
</code></pre>

Most of time we will use just .NET to .NET communication with usual binds and everything works fine since we are talking the same language. However, as you can see in the service contract declaration I have a WebInvoke attribute (and a webHttp binding) in order to be able to also talk JSON since one of our apps will be built for iPhone and this guy will talk JSON.

My problem is that whenever I throw a FaultException<DefaultFault> and have includeExceptionDetails="false" in the config file the calling client will get a generic HTTP error instead of my custom message. 

I understand that this is the correct behavior when includeExceptionDetails is turned off, but I think I saw some configuration a long time ago to allow some exceptions/faults to pass through the service boundaries. 

Is there such thing like this? If not, what do u suggest for my case?

Thanks a LOT!