/// <summary> /// Accepts the common exception type enum and bound with extra fields /// </summary> public ServiceException(CommonExceptionType exType, params object[] fields) { _message = Resources.ResourceManager.GetString(exType.ToString()) ?? _message; _message = string.Format(_message, fields); _serviceDetail = new ServiceFaultDetail(); _serviceDetail.Add(_message); throw new FaultException <ServiceFaultDetail>(_serviceDetail, new FaultReason(exType.ToString())); }
/// <summary> /// Accepts the common exception type enum and bound with the thrwoed exception /// </summary> public ServiceException(CommonExceptionType exType, Exception ex) { _message = Resources.ResourceManager.GetString(exType.ToString()) + Environment.NewLine + " (" + ex.GetInnerExceptionMessage() + ")"; _serviceDetail = new ServiceFaultDetail(); _serviceDetail.Add(_message); if (ex.InnerException != null) { throw new FaultException <ServiceFaultDetail>(_serviceDetail, new FaultReason(exType.ToString()), new FaultCode(ex.InnerException.Source)); } throw new FaultException <ServiceFaultDetail>(_serviceDetail, new FaultReason(exType.ToString())); }