Improve native error handling (#10)

This commit is contained in:
Rohit Sangwan
2024-02-14 21:10:04 +05:30
committed by GitHub
parent edd5ec20a5
commit d187c8de83
5 changed files with 61 additions and 12 deletions
+9
View File
@@ -101,6 +101,15 @@ extension CBManagerState {
}
}
extension Error {
func toFlutterError() -> FlutterError {
let nsError = self as NSError
let errorCode: String = .init(nsError.code)
let errorDescription: String = nsError.localizedDescription
return FlutterError(code: errorCode, message: errorDescription, details: nil)
}
}
public extension CBUUID {
var uuidStr: String {
uuidString.lowercased()