Skip to content

Commit

Permalink
Update sendMessageCompletion to handle BLEManagerError.noData case wi…
Browse files Browse the repository at this point in the history
…th human-readable message

- Current method retuns: "The operation couldn’t be completed. (SwiftOBD2.BLEManagerError error 5.)" for "No DATA"
  • Loading branch information
SOGAPPS committed May 6, 2024
1 parent 30f9995 commit 9a8c5ef
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Sources/SwiftOBD2/Communication/bleManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 9a8c5ef

Please sign in to comment.