From 58caab58dfe51623ad55da6df3ed48e2dd4503fa Mon Sep 17 00:00:00 2001 From: Diego Rey Mendez Date: Mon, 15 Apr 2024 12:46:51 +0200 Subject: [PATCH] Fixes some small mistakes --- LocalPackages/PixelKit/Sources/PixelKit/PixelKit.swift | 6 ++++-- .../PixelKit/Sources/PixelKit/PixelKitEventV2.swift | 1 - .../Sources/PixelKitTestingUtilities/PixelKitMock.swift | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/LocalPackages/PixelKit/Sources/PixelKit/PixelKit.swift b/LocalPackages/PixelKit/Sources/PixelKit/PixelKit.swift index eec1e1332cb..1a334f79080 100644 --- a/LocalPackages/PixelKit/Sources/PixelKit/PixelKit.swift +++ b/LocalPackages/PixelKit/Sources/PixelKit/PixelKit.swift @@ -279,12 +279,14 @@ public final class PixelKit { let newError: Error? - if let event = event as? PixelKitEventV2 { + if let event = event as? PixelKitEventV2, + let error = event.error { + // For v2 events we only consider the error specified in the event // and purposedly ignore the parameter in this call. // This is to encourage moving the error over to the protocol error // instead of still relying on the parameter of this call. - newError = event.error + newError = error } else { newError = error } diff --git a/LocalPackages/PixelKit/Sources/PixelKit/PixelKitEventV2.swift b/LocalPackages/PixelKit/Sources/PixelKit/PixelKitEventV2.swift index d6b2269afde..73da26d596c 100644 --- a/LocalPackages/PixelKit/Sources/PixelKit/PixelKitEventV2.swift +++ b/LocalPackages/PixelKit/Sources/PixelKit/PixelKitEventV2.swift @@ -47,7 +47,6 @@ public protocol PixelFiring { frequency: PixelKit.Frequency) async throws -> Bool } - extension PixelKit: PixelFiring { @discardableResult public func fire(_ event: PixelKitEventV2) async throws -> Bool { diff --git a/LocalPackages/PixelKit/Sources/PixelKitTestingUtilities/PixelKitMock.swift b/LocalPackages/PixelKit/Sources/PixelKitTestingUtilities/PixelKitMock.swift index 108a4a63ad2..df442748db9 100644 --- a/LocalPackages/PixelKit/Sources/PixelKitTestingUtilities/PixelKitMock.swift +++ b/LocalPackages/PixelKit/Sources/PixelKitTestingUtilities/PixelKitMock.swift @@ -1,5 +1,5 @@ // -// PixelFireMock.swift +// PixelKitMock.swift // // Copyright © 2024 DuckDuckGo. All rights reserved. //