fix error handling in patches

This commit is contained in:
Evil Factory
2022-07-01 14:14:44 -03:00
parent 4a706c504a
commit a6f7a4aff8
@@ -266,8 +266,7 @@ namespace Barotrauma
if (classType == null) if (classType == null)
{ {
GameMain.LuaCs.HandleException(new Exception($"Invalid class name '{className}'.")); throw new ArgumentNullException($"Invalid class name '{className}'.");
return null;
} }
MethodInfo methodInfo = null; MethodInfo methodInfo = null;
@@ -285,7 +284,7 @@ namespace Barotrauma
if (methodInfo == null) if (methodInfo == null)
{ {
string parameterNamesStr = parameterNames == null ? "" : string.Join(", ", parameterNames); 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; return methodInfo;