Xero-NetStandard icon indicating copy to clipboard operation
Xero-NetStandard copied to clipboard

GetAssetTypesAsync return null

Open ThomasLoSG opened this issue 1 year ago • 2 comments

Exception ExceptionFactory(string methodName, IApiResponse response)
{
    var statusCode = (int)response.StatusCode;
    switch (statusCode)
    {
        case 400:
            return new XeroApiException(statusCode, $"Xero API 400 error calling {(object)methodName} :{(object)response.Content.ToString()}", response.Headers, response.Content);
        default:
            return statusCode > 400 ? new XeroApiException(statusCode,
        $"Xero API error calling {(object)methodName}: {(object)response.Content.ToString()}", response.Headers, response.Content) : (Exception)null;
    }
}
var faInstance = new AssetApi()
{
    ExceptionFactory = ExceptionFactory
};

List<AssetType> ats = null;
Task.Run(async () =>
{
    try
    {        
        ats = await faInstance.GetAssetTypesAsync(token.AccessToken, tenant.TenantId.ToString());
    }
    catch (XeroApiException xe)
    {
    }
}).Wait();

No error generated but ats remain null

ThomasLoSG avatar Jan 05 '24 04:01 ThomasLoSG

PETOSS-378

github-actions[bot] avatar Jan 05 '24 04:01 github-actions[bot]

Thanks for raising an issue, a ticket has been created to track your request

github-actions[bot] avatar Jan 05 '24 04:01 github-actions[bot]