Exemple #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());
 }
Exemple #3
0
 public static string GetText(this ExceptionCodes code)
 {
     return(_errorCodeText[code]);
 }
 public TedExeption(ExceptionCodes code, string message, Exception innerException)
     : base(message, innerException)
 {
     Code = code;
 }
 public TedExeption(ExceptionCodes code)
     : base($"Exception with code '{code.ToString()}' was thrown")
 {
     Code = code;
 }
 public TedExeption(ExceptionCodes code, string message)
     : base(message)
 {
     Code = code;
 }
Exemple #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));
 }
Exemple #8
0
 public LanguageException(ExceptionCodes code)
 {
     CodeNumber   = (int)code;
     ErrorMessage = code.GetText();
 }
 public SlideDotNetException(string message, ExceptionCodes exceptionCode) : base(message)
 {
     ErrorCode = (int)exceptionCode;
 }
Exemple #10
0
 public DOMException(ExceptionCodes code)
     : base((code).ToString())
 {
     this.code = (int)code;
 }
Exemple #11
0
 public DOMException(ExceptionCodes code)
     : base((code).ToString())
 {
     this.code = (int)code;
 }
Exemple #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;
 }