Esempio n. 1
0
 static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     if (e.ExceptionObject is Exception)
     {
         GA.OnGlobalError(sender, e.ExceptionObject as Exception);
     }
     else
     {
         WriteUnhandledException("应用崩溃了:{0}", e.ExceptionObject);
     }
 }
Esempio n. 2
0
File: GA.cs Progetto: sinxiaji/Aoite
 static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     //System.Runtime.CompilerServices.RuntimeWrappedException
     if (e.ExceptionObject is Exception)
     {
         GA.OnGlobalError(sender, e.ExceptionObject as Exception);
     }
     else
     {
         WriteUnhandledException("应用崩溃了:{0}", e.ExceptionObject);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// 如果结果出现异常则抛出错误,否则不做任何处理。
        /// </summary>
        /// <typeparam name="TResult">结果的数据类型。</typeparam>
        /// <param name="result"><see cref="System.Result"/> 的派生类实例。</param>
        public static TResult ThrowIfFailded <TResult>(this TResult result)
            where TResult : Result
        {
            if (result == null)
            {
                throw new ArgumentNullException("result");
            }

            if (result.IsFailed)
            {
                GA.OnGlobalError(result, result.Exception);
                throw result.Exception;
            }
            return(result);
        }
Esempio n. 4
0
        private static void OnceInvoke(object state)
        {
            AsyncJob tme = state as AsyncJob;

            if (tme.WaitForNextTask())
            {
                return;
            }
            try
            {
                tme.RunTask();
            }
            catch (Exception ex)
            {
                GA.OnGlobalError(tme, ex);
                throw;
            }
        }