Skip to content

Commit 9dfde85

Browse files
ref: type KSCrash installer monitors
Use KSCrash's MonitorType through the installer interface instead of passing an untyped UInt mask. This removes the raw-value conversion at configuration and keeps the integration and its test mock type-safe.
1 parent fc38a64 commit 9dfde85

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

Sources/Swift/Integrations/KSCrash/SentryKSCrash+Installer.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ extension SentryKSCrash {
1414
/// - Throws: Any error from `KSCrash.installWithConfiguration(_:error:)`.
1515
func install(
1616
installPath: String,
17-
monitors: UInt,
17+
monitors: MonitorType,
1818
enableMemoryIntrospection: Bool,
1919
enableSwapCxaThrow: Bool
2020
) throws
@@ -53,13 +53,13 @@ extension SentryKSCrash {
5353

5454
func install(
5555
installPath: String,
56-
monitors: UInt,
56+
monitors: MonitorType,
5757
enableMemoryIntrospection: Bool,
5858
enableSwapCxaThrow: Bool
5959
) throws {
6060
let config = KSCrashConfiguration()
6161
config.installPath = installPath
62-
config.monitors = MonitorType(rawValue: monitors)
62+
config.monitors = monitors
6363
config.enableMemoryIntrospection = enableMemoryIntrospection
6464
config.enableSwapCxaThrow = enableSwapCxaThrow
6565
config.reportStoreConfiguration.reportCleanupPolicy = .onSuccess

Sources/Swift/Integrations/KSCrash/SentryKSCrash+Integration.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ extension SentryKSCrash {
1111
/// Mach exceptions, signals, C++ exceptions, and NSExceptions.
1212
/// KSCrash unconditionally adds its required infrastructure monitors on top of
1313
/// the crash detectors passed here.
14-
static let productionSafeMonitors: UInt = MonitorType([
14+
static let productionSafeMonitors: MonitorType = [
1515
.machException,
1616
.signal,
1717
.cppException,
1818
.nsException
19-
]).rawValue
19+
]
2020

2121
final class Integration<Dependencies: DependencyProvider>: NSObject, SwiftIntegration {
2222
private weak var options: Options?

Tests/SentryTests/Integrations/KSCrash/MockKSCrashInstaller.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#if SDK_V10
22
@_spi(Private) import SentryTestUtils
33
@_spi(Private) @testable import Sentry
4+
internal import KSCrashRecording
45

56
final class MockKSCrashDependencies: SentryKSCrash.DependencyProvider {
67
typealias Installing = MockKSCrashInstaller
@@ -32,7 +33,7 @@ final class MockKSCrashInstaller: SentryKSCrash.Installing {
3233
public var installCalls: [
3334
(
3435
installPath: String,
35-
monitors: UInt,
36+
monitors: MonitorType,
3637
enableMemoryIntrospection: Bool,
3738
enableSwapCxaThrow: Bool
3839
)
@@ -52,7 +53,7 @@ final class MockKSCrashInstaller: SentryKSCrash.Installing {
5253

5354
public func install(
5455
installPath: String,
55-
monitors: UInt,
56+
monitors: MonitorType,
5657
enableMemoryIntrospection: Bool,
5758
enableSwapCxaThrow: Bool
5859
) throws {

0 commit comments

Comments
 (0)