Skip to content

Commit 0a90774

Browse files
committed
Handle special Error types in sample
1 parent 6d3bb56 commit 0a90774

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Example/Paystack iOS Example/ViewController.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ class ViewController: UIViewController, PSTCKPaymentCardTextFieldDelegate {
112112
self.outputOnLabel(str: "Charge errored")
113113
// what should I do if an error occured?
114114
print(error)
115+
if error._code == PSTCKErrorCode.PSTCKExpiredAccessCodeError.rawValue{
116+
// access code could not be used
117+
// we may as well try afresh
118+
}
119+
if error._code == PSTCKErrorCode.PSTCKConflictError.rawValue{
120+
// another transaction is currently being
121+
// processed by the SDK... please wait
122+
}
115123
if let errorDict = (error._userInfo as! NSDictionary?){
116124
if let errorString = errorDict.value(forKeyPath: "com.paystack.lib:ErrorMessageKey") as! String? {
117125
if let reference=reference {

0 commit comments

Comments
 (0)