Пример #1
0
        public ServerFaultDetail?ProvideFaultOrIgnore(ServerCallInterceptorContext context, Exception error)
        {
            if (error is NotSupportedException || error is InvalidOperationException)
            {
                // provide detailed information for the client error handler
                var detail = new UnexpectedErrorDetail
                {
                    Message       = error.Message,
                    ExceptionType = error.GetType().FullName,
                    FullException = error.ToString(),
                    MethodName    = Process.GetCurrentProcess().ProcessName
                };

                return(new ServerFaultDetail {
                    Detail = detail
                });
            }

            // ignore other exceptions
            return(null);
        }
Пример #2
0
 public UnexpectedErrorException(UnexpectedErrorDetail detail)
     : base(detail.Message)
 {
     Detail = detail;
 }