throw exception when pull a repository and it is not set

This commit is contained in:
Bob Sun 2017-02-09 19:44:12 +08:00
parent e204ac1f9c
commit 0b43fc07d0
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4

View file

@ -107,6 +107,9 @@ class PasswordStore {
}
func pullRepository(transferProgressBlock: @escaping (UnsafePointer<git_transfer_progress>, UnsafeMutablePointer<ObjCBool>) -> Void) throws {
if gitCredential == nil {
throw NSError(domain: "me.mssun.pass.error", code: 1, userInfo: [NSLocalizedDescriptionKey: "Git Repository is not set."])
}
let credentialProvider = try gitCredential!.credentialProvider()
let options: [String: Any] = [
GTRepositoryRemoteOptionsCredentialProvider: credentialProvider