As you know, it\'s recomended handle exceptions using FaultException with standard WCF service to hide exception details. That\'s fine but i\'m having problem with WCF Ria servi
I've read about using WCF faults in Silverlight, but haven't yet tried it with WCF RIA.
http://mark.mymonster.nl/2011/02/10/make-use-of-wcf-faultcontracts-in-silverlight-clients/
Here's what Colin Blair answered to my question here
The DomainService has an overridable method named OnError. Whenever there is an exception within the DomainService itself (not within the WCF code) the exception will be passed to OnError before it is rethrown to be sent back to the client. If you replace the exception in the DomainServiceErrorInfo passed into the OnError method with your own exception then your exception will be the one that gets sent back to the client. If you use the DomainException for your exception then you will be able to pass in an ErrorCode integer which you can use client side to determine the actual error.
It answers my question and needs. Thanks Colin.
Code example:
[EnableClientAccess()]
public class YourDomainService : DomainService
{
protected override void OnError(DomainServiceErrorInfo errorInfo)
{
base.OnError(errorInfo);
customErrorHandler(errorInfo.Error);
}
private void customErrorHandler(Exception ex)
{
DomainServiceContext sc = this.ServiceContext;
//Write here your custom logic handling exceptions
}
}