From a6f7a4aff8844c60e70310a39ac75f4b54bcad73 Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Fri, 1 Jul 2022 14:14:44 -0300 Subject: [PATCH] fix error handling in patches --- Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsHook.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsHook.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsHook.cs index 384ef9289..242d60deb 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsHook.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsHook.cs @@ -266,8 +266,7 @@ namespace Barotrauma if (classType == null) { - GameMain.LuaCs.HandleException(new Exception($"Invalid class name '{className}'.")); - return null; + throw new ArgumentNullException($"Invalid class name '{className}'."); } MethodInfo methodInfo = null; @@ -285,7 +284,7 @@ namespace Barotrauma if (methodInfo == null) { string parameterNamesStr = parameterNames == null ? "" : string.Join(", ", parameterNames); - GameMain.LuaCs.HandleException(new Exception($"Method '{methodName}' with parameters '{parameterNamesStr}' not found in class '{className}'")); + throw new ArgumentNullException($"Method '{methodName}' with parameters '{parameterNamesStr}' not found in class '{className}'"); } return methodInfo;