@@ -79,12 +79,7 @@ public static void OnHandleUnresolvedException(object sender, UnhandledException
7979 {
8080 Debug . Log ( "Unhandled exception: " + exception . ToString ( ) ) ;
8181#if UNITY_IOS && ! UNITY_EDITOR
82- var exceptionWrapper = CreateWrapperException ( exception ) ;
83- var errorId = CrashesInternal . TrackException ( exceptionWrapper . GetRawObject ( ) , null , null ) ;
84- if ( _enableErrorAttachmentsCallbacks )
85- {
86- SendErrorAttachments ( errorId ) ;
87- }
82+ TrackErrorWithAttachments ( exception ) ;
8883#else
8984 lock ( _unhandledExceptions )
9085 {
@@ -335,18 +330,25 @@ private static IEnumerator SendUnhandledExceptionReports()
335330 }
336331 if ( exception != null )
337332 {
338- var exceptionWrapper = CreateWrapperException ( exception ) ;
339- var errorId = CrashesInternal . TrackException ( exceptionWrapper . GetRawObject ( ) , null , null ) ;
340- if ( _enableErrorAttachmentsCallbacks )
341- {
342- SendErrorAttachments ( errorId ) ;
343- }
333+ TrackErrorWithAttachments ( exception ) ;
344334 }
345335 yield return null ; // report remaining exceptions on next frames
346336 }
347337 }
348338#endif
349339
340+ private static void TrackErrorWithAttachments ( Exception exception )
341+ {
342+ var exceptionWrapper = CreateWrapperException ( exception ) ;
343+ var errorId = CrashesInternal . TrackException ( exceptionWrapper . GetRawObject ( ) , null , null ) ;
344+
345+ // when the main thread was not crashed attachments should be sent
346+ if ( _enableErrorAttachmentsCallbacks )
347+ {
348+ SendErrorAttachments ( errorId ) ;
349+ }
350+ }
351+
350352 private static WrapperException CreateWrapperException ( Exception exception )
351353 {
352354 var exceptionWrapper = new WrapperException ( ) ;
0 commit comments