From f8e940706887ed0876e25d2c7cc760c1390d465f Mon Sep 17 00:00:00 2001 From: Vijay Sharma Date: Thu, 14 May 2020 10:34:02 -0400 Subject: [PATCH] Automatically collect throwables from C# --- Plugins/TestFairy.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Plugins/TestFairy.cs b/Plugins/TestFairy.cs index b63b775..61892e6 100644 --- a/Plugins/TestFairy.cs +++ b/Plugins/TestFairy.cs @@ -400,6 +400,7 @@ public static void setServerEndpoint(string endpoint) public static void begin(string APIKey) { + TestFairy.installUnityCrashHandler(); TestFairy_begin(APIKey); } @@ -463,6 +464,7 @@ public static void begin(string APIKey) activityContext = activityClass.GetStatic("currentActivity"); } + TestFairy.installUnityCrashHandler(); TestFairy.callMethod("begin", activityContext, APIKey); } @@ -567,6 +569,14 @@ public static bool setAttribute(string aKey, string aValue) { return false; } #endif + private static void installUnityCrashHandler() { + Application.logMessageReceivedThreaded += TestFairy.logMsgRecvThreaded; + } + private static void logMsgRecvThreaded(string _condition, string _stackTrace, LogType _type) { + if (_type==LogType.Exception) { + TestFairy.logException(_condition, _stackTrace); + } + } } }