public static string GetSerializedValue(this ErrorReason a) { switch (a) { case ErrorReason.Forbidden: return("forbidden"); case ErrorReason.Timeout: return("timeout"); case ErrorReason.ResourceDoesNotExist: return("resource-does-not-exist"); case ErrorReason.InvalidData: return("invalid-data"); default: throw new Exception("Error reason has invalid value: " + a.ToString()); } }
/// <summary> /// Notification that a call context was closed prematurely, typically due to a timeout /// or the session being closed. /// </summary> /// <remarks> /// No further calls will be made for the context. /// </remarks> public void OnError(ErrorReason errorReason) { Error = new Exception("This context was closed prematurely. Reason=" + errorReason.ToString()); resetEvent.Set(); }
/// <summary> /// Notification that a call context was closed prematurely, typically due to a timeout or /// the session being closed. /// </summary> /// <param name="errorReason">The error reason.</param> /// <remarks> /// No further calls will be made for the context. /// </remarks> public void OnError( ErrorReason errorReason ) { Error = new Exception( "This context was closed prematurely. Reason=" + errorReason.ToString() ); resetEvent.Set(); }
public BusinessException(ErrorReason reason, string message = null, Exception innerException = null) : base(message ?? reason.ToString(), innerException) { Reason = reason; }
public static void AddErrorReasonHeader(HttpContext context, ErrorReason reason) { context.Response.Headers.Add(SiteConstant.ErrorReasonResposeHeaderName, reason.ToString()); }