diff --git a/BetterGenshinImpact/GameTask/AutoPathing/PathExecutor.cs b/BetterGenshinImpact/GameTask/AutoPathing/PathExecutor.cs index 97a51ed8..0f02f1ae 100644 --- a/BetterGenshinImpact/GameTask/AutoPathing/PathExecutor.cs +++ b/BetterGenshinImpact/GameTask/AutoPathing/PathExecutor.cs @@ -220,6 +220,10 @@ public class PathExecutor break; } + catch (HandledException handledException) + { + break; + } catch (NormalEndException normalEndException) { Logger.LogInformation(normalEndException.Message); @@ -1282,7 +1286,7 @@ public class PathExecutor { if (EndAction != null && EndAction(ra)) { - throw new NormalEndException("达成结束条件,结束地图追踪"); + throw new HandledException("达成结束条件,结束地图追踪"); } } } \ No newline at end of file diff --git a/BetterGenshinImpact/GameTask/Common/Exceptions/HandledException.cs b/BetterGenshinImpact/GameTask/Common/Exceptions/HandledException.cs new file mode 100644 index 00000000..7db7337c --- /dev/null +++ b/BetterGenshinImpact/GameTask/Common/Exceptions/HandledException.cs @@ -0,0 +1,9 @@ +namespace BetterGenshinImpact.GameTask.AutoGeniusInvokation.Exception; // TODO: change this namespace to BetterGenshinImpact.GameTask.Common.Exception + +/// +/// 无需再次抛出的异常类,通常用于在任务中捕获异常后处理完毕,不要再向上抛出异常。 +/// +/// +public class HandledException(string message) : System.Exception(message) +{ +}