public RpcErrorExceptionInfo ConvertExceptionToErrorExceptionInfo(string databaseName, Exception ex) { RpcErrorExceptionInfo rpcErrorExceptionInfo = new RpcErrorExceptionInfo(); if (ex == null) { return(rpcErrorExceptionInfo); } TBaseException ex2 = ex as TBaseException; TBaseTransientException ex3 = ex as TBaseTransientException; string errorMessage; if (ex2 != null) { errorMessage = HaRpcExceptionWrapperBase <TBaseException, TBaseTransientException> .SetExceptionProperties <TBaseException>(ex2, true, databaseName); } else if (ex3 != null) { errorMessage = HaRpcExceptionWrapperBase <TBaseException, TBaseTransientException> .SetExceptionProperties <TBaseTransientException>(ex3, true, databaseName); } else { errorMessage = ex.ToString(); } rpcErrorExceptionInfo.ErrorMessage = errorMessage; rpcErrorExceptionInfo.ReconstitutedException = ex; HaRpcExceptionWrapperBase <TBaseException, TBaseTransientException> .TrySerializeException(ex, rpcErrorExceptionInfo); return(rpcErrorExceptionInfo); }
private Exception ConstructClientExceptionFromServerException(string originatingServerName, Exception serverException) { TBaseException ex = serverException as TBaseException; TBaseTransientException ex2 = serverException as TBaseTransientException; if (ex == null && ex2 == null) { if (this.IsKnownException(serverException)) { return(serverException); } if (serverException is TransientException) { ex2 = this.GetGenericOperationFailedTransientException(serverException.Message, serverException); HaRpcExceptionWrapperBase <TBaseException, TBaseTransientException> .SetExceptionProperties <TBaseTransientException>(ex2, false, null); } else { ex = this.GetGenericOperationFailedException(serverException.Message, serverException); HaRpcExceptionWrapperBase <TBaseException, TBaseTransientException> .SetExceptionProperties <TBaseException>(ex, false, null); } } Exception result; if (ex != null) { result = ex; this.SetExceptionServerNameIfEmpty <TBaseException>(ex, originatingServerName); } else { result = ex2; this.SetExceptionServerNameIfEmpty <TBaseTransientException>(ex2, originatingServerName); } return(result); }