Skip to content

Commit 2938ddb

Browse files
committed
Fix: Add error event on to location monitoring
1 parent d67da05 commit 2938ddb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/AsyncLocationKit/Performers/MonitoringUpdateLocationPerformer.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ public enum LocationUpdateEvent {
55
case didPaused
66
case didResume
77
case didUpdateLocations(locations: [CLLocation])
8+
case didFailWith(error: Error)
89
}
910

1011
class MonitoringUpdateLocationPerformer: AnyLocationPerformer {
@@ -15,7 +16,7 @@ class MonitoringUpdateLocationPerformer: AnyLocationPerformer {
1516

1617
var uniqueIdentifier: UUID = UUID()
1718

18-
var eventsSupport: [CoreLocationEventSupport] = [.didUpdateLocations, .locationUpdatesPaused, .locationUpdatesResume]
19+
var eventsSupport: [CoreLocationEventSupport] = [.didUpdateLocations, .locationUpdatesPaused, .locationUpdatesResume, .didFailWithError]
1920

2021
var cancellabel: Cancellabel?
2122
var stream: LocationStream.Continuation?
@@ -36,6 +37,8 @@ class MonitoringUpdateLocationPerformer: AnyLocationPerformer {
3637
stream?.yield(.didPaused)
3738
case .locationUpdatesResume:
3839
stream?.yield(.didResume)
40+
case .didFailWithError(let error):
41+
stream?.yield(.didFailWith(error: error))
3942
default:
4043
fatalError("Method can't be execute by this performer: \(String(describing: self)) for event: \(type(of: event))")
4144
}

0 commit comments

Comments
 (0)