protected override void OnFailed(CommandExecutorFailureEventArgs args) { //调用基类同名方法 base.OnFailed(args); if (args.Exception is ExitException) { args.Exception = null; } else { args.ExceptionHandled = true; this.Terminal.WriteLine(CommandOutletColor.Red, args.Exception.Message); } }
protected override void OnFailed(CommandExecutorFailureEventArgs args) { //调用基类同名方法 base.OnFailed(args); if (args.Exception is ExitException) { args.Exception = null; } else { args.ExceptionHandled = true; this.Terminal.WriteLine(CommandOutletColor.Red, Resources.ResourceUtility.GetString("Text.CommandError.Label") + args.Exception.Message); } }
protected virtual void OnFailed(CommandExecutorFailureEventArgs args) { this.Failed?.Invoke(this, args); }
protected bool OnFailed(CommandExecutorContext context, Exception ex) { var args = new CommandExecutorFailureEventArgs(context, ex); //激发“Failed”事件 this.OnFailed(args); //输出异常信息 if(!args.ExceptionHandled && args.Exception != null) this.Error.WriteLine(args.Exception); return args.ExceptionHandled; }