indy-sdk icon indicating copy to clipboard operation
indy-sdk copied to clipboard

fix(objective c wrapper) NSError should be nil when there is no error

Open conanoc opened this issue 4 years ago • 1 comments

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.

conanoc avatar Nov 04 '21 02:11 conanoc

@mirgee, Is this something you could review?

WadeBarnes avatar Feb 01 '22 15:02 WadeBarnes