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()); }
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; }
/// <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)); }
public LanguageException(ExceptionCodes code) { CodeNumber = (int)code; ErrorMessage = code.GetText(); }
public SlideDotNetException(string message, ExceptionCodes exceptionCode) : base(message) { ErrorCode = (int)exceptionCode; }
public DOMException(ExceptionCodes code) : base((code).ToString()) { this.code = (int)code; }
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; }