From 9a8c5effe93904908570dd8b9bf2ecd28f594c60 Mon Sep 17 00:00:00 2001 From: sogapps Date: Sun, 5 May 2024 22:00:43 -0400 Subject: [PATCH] =?UTF-8?q?Update=20sendMessageCompletion=20to=20handle=20?= =?UTF-8?q?BLEManagerError.noData=20case=20with=20human-readable=20message?= =?UTF-8?q?=20-=20Current=20method=20retuns:=20"The=20operation=20couldn?= =?UTF-8?q?=E2=80=99t=20be=20completed.=20(SwiftOBD2.BLEManagerError=20err?= =?UTF-8?q?or=205.)"=20for=20"No=20DATA"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/SwiftOBD2/Communication/bleManager.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sources/SwiftOBD2/Communication/bleManager.swift b/Sources/SwiftOBD2/Communication/bleManager.swift index f7718db..a10882c 100644 --- a/Sources/SwiftOBD2/Communication/bleManager.swift +++ b/Sources/SwiftOBD2/Communication/bleManager.swift @@ -299,7 +299,12 @@ class BLEManager: NSObject, CommProtocol { if let response = response { continuation.resume(returning: response) } else if let error = error { - continuation.resume(throwing: error) + if let bleError = error as? BLEManagerError { + // Handle the BLEManagerError cases + continuation.resume(returning: [bleError.description]) + } else { + continuation.resume(throwing: error) + } } self.sendMessageCompletion = nil }