Наследование: System.SystemException
Пример #1
0
        public static bool ConvertException(COMException e, out Exception newException)
        {
            var flag = true;

            switch (e.HResult)
            {
            case -2147220992:
                newException = new ElementNotEnabledException(innerException: e);
                break;

            case -2147220991:
                newException = new ElementNotAvailableException(innerException: e);
                break;

            case -2147220990:
                newException = new NoClickablePointException(innerException: e);
                break;

            case -2147220989:
                newException = new ProxyAssemblyNotLoadedException(innerException: e);
                break;

            default:
                newException = null;
                flag         = false;
                break;
            }

            return(flag);
        }
Пример #2
0
        internal static bool ConvertException(System.Runtime.InteropServices.COMException e, out Exception uiaException)
        {
            bool handled = true;
            switch (e.ErrorCode)
            {
                case UiaCoreIds.UIA_E_ELEMENTNOTAVAILABLE:
                    uiaException = new ElementNotAvailableException(e);
                    break;

                case UiaCoreIds.UIA_E_ELEMENTNOTENABLED:
                    uiaException = new ElementNotEnabledException(e);
                    break;

                case UiaCoreIds.UIA_E_NOCLICKABLEPOINT:
                    uiaException = new NoClickablePointException(e);
                    break;

                case UiaCoreIds.UIA_E_PROXYASSEMBLYNOTLOADED:
                    uiaException = new ProxyAssemblyNotLoadedException(e);
                    break;

                default:
                    uiaException = null;
                    handled = false;
                    break;
            }
            return handled;
        }
Пример #3
0
		private static Exception BuildException (string exceptionInfo)
		{
			int colonIndex = exceptionInfo.IndexOf (": ");
			if (colonIndex == -1)
				return null;
			string errorName = exceptionInfo.Substring (0, colonIndex);
			string errorMessage = exceptionInfo.Substring (colonIndex + 2);

			Exception ret = null;
			if (errorName == dbusInvalidArgsError)
				ret = new ArgumentException (exceptionInfo);
			if (Array.BinarySearch (dbusErrorList, errorName) >= 0) {
				ret = new ElementNotAvailableException (exceptionInfo);
			} else {
				try {
					Type type = GetType (errorName);
					if (type != null)
						ret = Activator.CreateInstance (type, errorMessage) as Exception;
				} catch {
					ret = null;
				}
			}
			return ret;
		}