45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using BeWo.ServerUtils.Core;
|
|
using BS.Shared.Core;
|
|
using DevExpress.CodeParser.Diagnostics;
|
|
using log4net;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Runtime.Serialization;
|
|
using System.Runtime.Serialization.Json;
|
|
using System.ServiceModel;
|
|
using System.ServiceModel.Channels;
|
|
using System.ServiceModel.Dispatcher;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Xml;
|
|
|
|
namespace BeWo.Service.ServiceBehavior.WCFError
|
|
{
|
|
public class WCFErrorHandler : IErrorHandler
|
|
{
|
|
private static readonly log4net.ILog log = LoggerUtils.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
|
|
|
public bool HandleError(Exception exception)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public void ProvideFault(Exception error, MessageVersion version, ref Message message)
|
|
{
|
|
// Logge in File
|
|
log.Error(error);
|
|
|
|
var wcfError = Core.Utils.CreateBeWoFaultException(error);
|
|
|
|
var fault = wcfError.CreateMessageFault();
|
|
|
|
string action = OperationContext.Current.IncomingMessageHeaders.Action;
|
|
|
|
message = Message.CreateMessage(version, fault, action);
|
|
}
|
|
}
|
|
}
|