问题描述
嗨,我正在为 Windows 桌面应用程序实现 oauth xero api。
当我将数据以错误的细节推送到 xero 时,我得到 api 异常,其中包含元素,元素内部有 ValidationError 我想获得该验证错误以向用户显示导致异常的实际错误。
以下是我遇到的异常,但我无法从中提取验证错误消息。有没有人试过这个,如果是的话请帮忙!
{
"ErrorNumber": 10,"Type": "ValidationException","Message": "A validation exception occurred","Elements": [
{
"ContactID": "00000000-0000-0000-0000-000000000000","ContactStatus": "ACTIVE","Name": "Clifford Constructions Pty Ltd","FirstName": "","LastName": "","EmailAddress": "e.gomez@cliffordconstructions.com.au","Taxnumber": "96 054 514 859","Addresses": [
{
"Addresstype": "POBox","AddressLine1": "PO Box 696 ","City": "HORNSBY","Region": "NSW","PostalCode": "1630","ValidationErrors": [ ]
}
],"Phones": [
{
"PhoneType": "MOBILE","PhoneNumber": "","ValidationErrors": [ ]
},{
"PhoneType": "DEFAULT","PhoneNumber": "(02) 9482 7288",{
"PhoneType": "FAX","PhoneNumber": "(02) 9482 7037","ContactGroups": [ ],"IsCustomer": true,"SalesTrackingCategories": [
{
"TrackingCategoryName": "Jobs","TrackingOptionName": "TA - Training","PaymentTerms": {
"Sales": {
"Day": 21,"Type": "DAYSAFTERBILLMONTH","ValidationErrors": [ ]
}
},"ContactPersons": [
{
"FirstName": "James ","LastName": "Handel","EmailAddress": "j.handel@cliffordconstructions.com.au","IncludeInEmails": false,"HasValidationErrors": true,"ValidationErrors": [
{ "Message": "There is no ACTIVE tracking option with the name 'TA - Training' for the tracking category with the name 'Jobs'" } ]
}
]
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)