Skip to content

ExceptionManager

Fridolin Wild edited this page Dec 8, 2023 · 7 revisions

ExceptionManager: Global notification of exceptions, publishing to Sentry.io

The ExceptionManager class registers in Awake() a hook to method LogCaughtException for Application.logMessageReceived, capturing error exceptions (including Null Reference, Divide by Zero, Out of Memory, Index Out of Range):

   Application.logMessageReceived += LogCaughtException;

It then uses the Sentry Unity lite implementation version 1.0.4 (MIT License, thus included in this repository, scripts SentrySdk.cs and Sentry.cs) to notify the online performance monitoring tool Sentry.io to log the error that appeared, so as to inform the development team:

   SentrySdk.CaptureMessage("ExceptionManager: ["+logType+"]" + logText + ", trace: " + stackTrace);

The ExceptionManager is attached to the RootView gameobject and initialised in the RootView_v2 class.