public void OnError(ExceptionContext context)
 {
     Console.WriteLine("Error: " + context.Exception.Message);
     Console.WriteLine();
     Parser.Run<CommandLineOptions>( new string[]{} , this);
     context.ReThrow = false;
 }
示例#2
0
        private void HandleError(ExceptionContext context)
        {
#if DEBUG
            System.Console.WriteLine(context.Exception.ToString());
            System.Console.ReadKey();
#endif
            context.ReThrow = true;
        }
示例#3
0
        static void err(ExceptionContext c)
        {
            Console.ForegroundColor = ConsoleColor.Red;

            Console.WriteLine(c.Exception.Message);

            Console.ResetColor();
        }
示例#4
0
		private static void HandleError(ExceptionContext e)
		{
			System.Console.WriteLine("\nUnexpected error occured:"
#if DEBUG
			                         + "\n" + e.Exception.ToString()
#else
							+ e.Exception.GetType().Name
							+ ": "
							+ e.Exception.Message
#endif
);
		}
示例#5
0
        public static void HandleError(ExceptionContext context) {
            context.ReThrow = false;

            Console.WriteLine();

            Console.ForegroundColor = ConsoleColor.Red;

            Exception ex = context.Exception;
            while (ex != null) {
                Console.WriteLine("Error: {0} {1}", ex.GetType().Name, ex.Message);

                ex = ex.InnerException;
            }

            Console.ForegroundColor = ConsoleColor.Gray;
        }
示例#6
0
文件: Samples.cs 项目: stemarie/CLAP
 void Error(ExceptionContext c)
 {
     Handled = true;
 }
示例#7
0
文件: Samples.cs 项目: stemarie/CLAP
 public void Error(ExceptionContext ex)
 {
     ex.ReThrow = true;
 }
示例#8
0
文件: Samples.cs 项目: stemarie/CLAP
 public void Error(ExceptionContext ex)
 {
 }
示例#9
0
文件: Samples.cs 项目: stemarie/CLAP
        public void Error(ExceptionContext ex)
        {
            Handled = true;

            ex.ReThrow = true;
        }
示例#10
0
        private bool TryHandlePrematureError(Exception ex, object[] targets)
        {
            var context = new ExceptionContext(ex);

            if (Register.RegisteredErrorHandler != null)
            {
                Register.RegisteredErrorHandler(context);

                return context.ReThrow;
            }
            else
            {
                for (int i = 0; i < m_types.Length; i++)
                {
                    var type = m_types[i];

                    var errorHandler = ParserRunner.GetDefinedErrorHandlers(type).FirstOrDefault();

                    if (errorHandler != null)
                    {
                        var target = targets == null ? null : targets[i];

                        errorHandler.Invoke(target, new[] { context });

                        return context.ReThrow;
                    }
                }
            }

            return true;
        }
示例#11
0
        private bool HandleError(Exception ex, object target)
        {
            var context = new ExceptionContext(ex);

            if (m_registration.RegisteredErrorHandler != null)
            {
                m_registration.RegisteredErrorHandler(context);

                return context.ReThrow;
            }
            else
            {
                var definedErrorHandlers = GetDefinedErrorHandlers(Type);

                Debug.Assert(definedErrorHandlers.Count() <= 1);

                var handler = definedErrorHandlers.FirstOrDefault();

                if (handler != null)
                {
                    MethodInvoker.Invoke(handler, target, new[] { context });

                    return context.ReThrow;
                }

                // no handler - rethrow
                //
                return true;
            }
        }
示例#12
0
文件: Program.cs 项目: serra/CLAP
 public static void Error(ExceptionContext ex)
 {
     Console.ForegroundColor = ConsoleColor.Red;
     Console.WriteLine(ex.Exception.Message);
     Console.ResetColor();
 }
示例#13
0
 public void Error(ExceptionContext e)
 {
     Log.Error(e.Exception, "An error occurred");
 }
示例#14
0
 public static void HandleError(ExceptionContext context)
 {
     Console.WriteLine(Tag + context.Exception.Message + ". Please check the help function");
     context.ReThrow = false;
 }