indy-sdk
indy-sdk copied to clipboard
fix(objective c wrapper) NSError should be nil when there is no error
Signed-off-by: conanoc [email protected]
Returning NSError with error code Success makes trouble sometimes. The following code snippet opens a wallet using async/await in swift5. It always throws error and does not return wallet handle because the error included in the completion handler is not nil.
let wallet = IndyWallet.sharedInstance()!
var walletHandle : IndyHandle?
do {
walletHandle = try await wallet.open(withConfig: walletConfig, credentials: walletCredentials)
} catch {
if let err = error as NSError? {
print("Cannot open wallet: \(err.userInfo["message"] ?? "Unknown error")")
}
return
}
So, NSError should be nil when the indy_error_code is Success.
@mirgee, Is this something you could review?