Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > SDKs >

API Error Handling in .Net Library

Started by Matthew Guillemette -   in SDKs


I'm currently looking into error handling with my company's Xero integration. Looking at your API in your github, it looks like I should be expecting an APIException but in testing it appears I only receive a generic exception.

So, instead of receiving the exception from the following code:
throw new Xero.NetStandard.OAuth2.Client.ApiException(400, "Missing required parameter 'xeroTenantId' when calling AccountingApi->GetItems");

I receive a generic exception with an inner exception message of:
"Missing required parameter 'xeroTenantId' when calling AccountingApi->GetItems"

I would like to utilize this APIException class to read error codes from, especially for 404's. Is the intended behavior to receive this class? Also, is my understanding correct that ApiResponse will only return a status code of 200 without errors (except for the case of a "summarizeErrors" is present)?