public static DxStoreServerFault ConvertExceptionToDxStoreFault(Exception exception) { DxStoreFaultCode faultCode = DxStoreFaultCode.General; bool isTransientError = true; if (exception is DxStoreInstanceNotReadyException) { faultCode = DxStoreFaultCode.InstanceNotReady; } else if (exception is DxStoreInstanceStaleStoreException) { faultCode = DxStoreFaultCode.Stale; } else if (exception is DxStoreCommandConstraintFailedException) { faultCode = DxStoreFaultCode.ConstraintNotSatisfied; } else if (exception is TimeoutException) { faultCode = DxStoreFaultCode.ServerTimeout; } else { isTransientError = false; } bool isLocalized = exception is LocalizedException; return(new DxStoreServerFault(exception, faultCode, isTransientError, isLocalized)); }
public DxStoreServerFault(Exception ex, DxStoreFaultCode faultCode, bool isTransientError, bool isLocalized) { this.IsLocalizedException = isLocalized; this.FaultCode = faultCode; this.IsTransientError = isTransientError; this.TypeName = ex.GetType().FullName; this.Message = ex.Message; this.StackTrace = ex.StackTrace; }