Skip to content

Commit f0985bd

Browse files
committed
always log monitor task errors
1 parent e257f31 commit f0985bd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/SwiftOCA/OCP.1/Ocp1Connection+Connect.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,14 @@ extension Ocp1Connection {
341341
}
342342

343343
func onMonitorError(id: Int, _ error: Error) async throws {
344+
logger.trace("monitor task \(id) error: \(error)")
345+
344346
if _connectionState.value != .notConnected {
345347
// don't update connection state if we were explicitly disconnected
346348
_updateConnectionState(error.ocp1ConnectionState)
347349
}
348350

349351
if _automaticReconnect, error._isRecoverableConnectionError {
350-
logger.trace("monitor task \(id) disconnecting: \(error)")
351352
try await _disconnectDeviceAfterConnectionFailure()
352353
Task.detached { try await self.reconnectDeviceWithBackoff() }
353354
}

0 commit comments

Comments
 (0)