/// <summary> /// /// </summary> public BaseException(CommonExceptionType errorType, Exception ex) { _message = Resources.ResourceManager.GetString(errorType.ToString()) ?? _message; _message = string.Format(_message, string.Empty); _exception = ex; }
/// <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())); }
/// <summary> /// /// </summary> public PresentationException(CommonExceptionType errorType, Exception ex) : base(errorType, ex) { if (ex.GetType() == typeof(CommunicationException)) { _message += Environment.NewLine + Resources.ResourceManager.GetString(CommonExceptionType.SerializationException.ToString()); } if (ex.GetType() == typeof(FaultException <ServiceFaultDetail>)) { var exceptionDetail = ((FaultException <ServiceFaultDetail>)ex).Detail; if (exceptionDetail != null) { _message += Environment.NewLine + exceptionDetail.Message; } } else { _message += Environment.NewLine + ex.Message; } throw new ApplicationException(_message); }
/// <summary> /// /// </summary> public BaseException(CommonExceptionType errorType, params object[] fields) { _message = Resources.ResourceManager.GetString(errorType.ToString()) ?? _message; _message = string.Format(_message, fields); }
/// <summary> /// Get exception messages as string based on CommonExceptionType enum /// </summary> public static string GetStringMessage(this CommonExceptionType exceptionType) { return(Resources.ResourceManager.GetString(exceptionType.ToString()) ?? string.Empty); }
/// <summary> /// /// </summary> public PresentationException(CommonExceptionType errorType, params object[] fields) : base(errorType, fields) { throw new ApplicationException(_message); }