【发布时间】:2017-02-28 10:20:55
【问题描述】:
如何以最佳方式从该错误结果中获取消息值。我尝试了很多,但没有得到价值,所以请帮助我
BUYClient.sharedClient.createCustomer(with: credentials) { (customer : BUYCustomer?,token: BUYCustomerToken?, error :Error?) -> Void in
if customer != nil{
print(token ?? "kuch nahi aaya")
print(customer?.fullName ?? "kuch nahi aaya")
}
let customer = error.debugDescription
print("value===\(customer)")
}
结果:
value===Optional(Error Domain=BUYShopifyErrorDomain Code=422 "(null)" UserInfo={errors={
customer = {
email = (
{
code = taken;
message = "has already been taken";
options = {
"rescue_from_duplicate" = 1;
value = "y@gmail.com";
};
}
);
};
}})
【问题讨论】: