Esempio n. 1
0
 public void ThrowOrIgnore(ClientCallInterceptorContext context, ClientFaultDetail detail)
 {
     // if marker is UnexpectedErrorDetail
     if (detail.Detail is UnexpectedErrorDetail unexpectedErrorDetail)
     {
         // throw custom exception
         throw new UnexpectedErrorException(unexpectedErrorDetail);
     }
 }
Esempio n. 2
0
 public void ThrowOrIgnore(ClientCallInterceptorContext context, ClientFaultDetail detail)
 {
     // if marker is ApplicationException
     if ((detail.Detail is string name) && name == "ApplicationException")
     {
         // throw custom exception
         throw new ApplicationException(detail.OriginalError.Status.Detail);
     }
 }
Esempio n. 3
0
        protected override void ThrowOrIgnoreCore(ClientCallInterceptorContext context, ClientFaultDetail detail)
        {
            // handle ApplicationExceptionFaultDetail
            if (detail.Detail is ApplicationExceptionFaultDetail appDetail)
            {
                throw new FaultException <ApplicationExceptionFaultDetail>(appDetail);
            }

            // handle InvalidOperationExceptionFaultDetail
            if (detail.Detail is InvalidOperationExceptionFaultDetail opDetail)
            {
                throw new FaultException <InvalidOperationExceptionFaultDetail>(opDetail);
            }

            // ignore other errors
        }
Esempio n. 4
0
 protected override void ThrowOrIgnoreCore(ClientCallInterceptorContext context, ClientFaultDetail detail)
 {
     if (detail.Detail is ExceptionDetail error)
     {
         throw new ServerException(error, detail.OriginalError);
     }
 }