From 314ea688062b5cd478331cf1147f005648c080ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=89=E9=B8=AD=E8=9B=8B?= Date: Wed, 9 Jul 2025 00:19:02 +0800 Subject: [PATCH] fixed #1791 --- BetterGenshinImpact/GameTask/AutoPathing/PathExecutor.cs | 6 +++++- .../GameTask/Common/Exceptions/HandledException.cs | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 BetterGenshinImpact/GameTask/Common/Exceptions/HandledException.cs 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) +{ +}