Skip to content

Commit

Permalink
Merge pull request #17 from SOGAPPS/feature/handle_ble_manager_error_…
Browse files Browse the repository at this point in the history
…cases

Update sendMessageCompletion to handle BLEManagerError with human-readable message
kkonteh97 authored May 6, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 30f9995 + 9a8c5ef commit 7c0574e
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
@@ -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
}

0 comments on commit 7c0574e

Please sign in to comment.