Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetAssetTypesAsync return null #497

Open
ThomasLoSG opened this issue Jan 5, 2024 · 2 comments
Open

GetAssetTypesAsync return null #497

ThomasLoSG opened this issue Jan 5, 2024 · 2 comments

Comments

@ThomasLoSG
Copy link

ThomasLoSG commented Jan 5, 2024

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

Copy link

github-actions bot commented Jan 5, 2024

PETOSS-378

Copy link

github-actions bot commented Jan 5, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant