Example #1
0
 public static void ThrowOnTrue(this bool b, ExceptionCodes errorCode)
 {
     if (b)
     {
         ThrowError(errorCode);
     }
 }
 public static (int code, string message, ResponseHint hint) Translate(ExceptionCodes code)
 {
     return(code.GetType()
            .GetField(Enum.GetName(typeof(ExceptionCodes), code))
            .GetCustomAttributes(false).Where((attr) =>
     {
         return (attr is ExceptionCodeAttribute);
     }).Select(customAttr =>
     {
         var attr = (customAttr as ExceptionCodeAttribute);
         return (attr.Code, attr.FriendlyMessage, attr.Hint);
     }).FirstOrDefault());
 }
Example #3
0
 public static string GetText(this ExceptionCodes code)
 {
     return(_errorCodeText[code]);
 }
Example #4
0
 public TedExeption(ExceptionCodes code, string message, Exception innerException)
     : base(message, innerException)
 {
     Code = code;
 }
Example #5
0
 public TedExeption(ExceptionCodes code)
     : base($"Exception with code '{code.ToString()}' was thrown")
 {
     Code = code;
 }
Example #6
0
 public TedExeption(ExceptionCodes code, string message)
     : base(message)
 {
     Code = code;
 }
Example #7
0
 /// <summary>
 /// Gets description of error code
 /// </summary>
 /// <param name="error">the error code</param>
 /// <returns>error description</returns>
 public static string GetDescription(this ExceptionCodes error)
 {
     return(GetDescriptionFromAttribute(error));
 }
Example #8
0
 public LanguageException(ExceptionCodes code)
 {
     CodeNumber   = (int)code;
     ErrorMessage = code.GetText();
 }
 public SlideDotNetException(string message, ExceptionCodes exceptionCode) : base(message)
 {
     ErrorCode = (int)exceptionCode;
 }
Example #10
0
 public DOMException(ExceptionCodes code)
     : base((code).ToString())
 {
     this.code = (int)code;
 }
Example #11
0
 public DOMException(ExceptionCodes code)
     : base((code).ToString())
 {
     this.code = (int)code;
 }
Example #12
0
 private static void ThrowError(ExceptionCodes errorCode)
 {
     throw new LanguageException(errorCode);
 }
 /// <summary>
 /// C-tor
 /// </summary>
 /// <param name="exceptionCode">Exception code</param>
 /// <param name="exceptionSubCode">Exception sub code</param>
 /// <param name="extraInfo">Exception extra info</param>
 public AgentException(ExceptionCodes exceptionCode, ExceptionSubCodes exceptionSubCode, string extraInfo = default(string))
 {
     ExceptionCode    = exceptionCode;
     ExceptionSubCode = exceptionSubCode;
     ExtraInfo        = extraInfo;
 }