Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- `sentry-native` is now built on Ubuntu 22.04 instead of Ubuntu 20.04, which reached EOL in May 2025. If you are running you game on a server on Ubuntu 20.04, you should update the OS before upgrading to this SDK version. ([#2355](https://github.com/getsentry/sentry-unity/pull/2355))

### Features

- The SDK no longer ends sessions as crashed when capturing unhandled or logged exceptions. Instead, sessions get correctly marked as `SessionEndStatus.Unhandled` ([#2376](https://github.com/getsentry/sentry-unity/pull/2376))

### Dependencies

- Bump CLI from v2.56.0 to v2.56.1 ([#2356](https://github.com/getsentry/sentry-unity/pull/2356))
Expand Down
6 changes: 4 additions & 2 deletions src/Sentry.Unity/Integrations/UnityErrorLogException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal class UnityErrorLogException : Exception
private readonly SentryOptions? _options;
private readonly IDiagnosticLogger? _logger;

public UnityErrorLogException(string logString, string logStackTrace, SentryOptions? options)
public UnityErrorLogException(string logString, string logStackTrace, SentryOptions? options) : base(logString)
{
_logString = logString;
_logStackTrace = logStackTrace;
Expand Down Expand Up @@ -54,7 +54,9 @@ public SentryException ToSentryException()
Mechanism = new Mechanism
{
Handled = true,
Type = "unity.log"
Type = "unity.log",
Synthetic = true,
Data = { { Mechanism.TerminalKey, false } }
}
};
}
Expand Down
3 changes: 1 addition & 2 deletions src/Sentry.Unity/Integrations/UnityLogHandlerIntegration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ internal void CaptureException(Exception exception, UnityEngine.Object? context)
// NOTE: This might not be entirely true, as a user could as well call `Debug.LogException`
// and expect a handled exception but it is not possible for us to differentiate
// https://docs.sentry.io/platforms/unity/troubleshooting/#unhandled-exceptions---debuglogexception
exception.Data[Mechanism.HandledKey] = false;
exception.Data[Mechanism.MechanismKey] = "Unity.LogException";
exception.SetSentryMechanism("Unity.LogException", handled: false, terminal: false);
_ = _hub.CaptureException(exception);
}

Expand Down
8 changes: 6 additions & 2 deletions test/Sentry.Unity.Tests/UnityErrorLogExceptionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ public void ToSentryException_ParsingTestCases(
Mechanism = new Mechanism
{
Handled = true,
Type = "unity.log"
Type = "unity.log",
Synthetic = true,
Data = { {Mechanism.TerminalKey, false} }
}
}
},
Expand Down Expand Up @@ -189,7 +191,9 @@ public void ToSentryException_ParsingTestCases(
Mechanism = new Mechanism
{
Handled = true,
Type = "unity.log"
Type = "unity.log",
Synthetic = true,
Data = { {Mechanism.TerminalKey, false} }
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions test/Sentry.Unity.Tests/UnityLogHandlerIntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ public void CaptureException_ExceptionCapturedAndMechanismSet()

Assert.IsTrue(capturedEvent.Exception!.Data.Contains(Mechanism.MechanismKey));
Assert.AreEqual("Unity.LogException", (string)capturedEvent.Exception!.Data[Mechanism.MechanismKey]);

Assert.IsTrue(capturedEvent.Exception!.Data.Contains(Mechanism.TerminalKey));
Assert.IsFalse((bool)capturedEvent.Exception!.Data[Mechanism.TerminalKey]);
}

[Test]
Expand Down
Loading