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

Bad error handling in filtering #339

Closed
bpotard opened this issue Sep 7, 2023 · 1 comment
Closed

Bad error handling in filtering #339

bpotard opened this issue Sep 7, 2023 · 1 comment

Comments

@bpotard
Copy link
Contributor

bpotard commented Sep 7, 2023

Hello,

A rather confusing one; the error handling seems to be broken in (some) of the filters, leading to confusing messaging:

>>> xero.invoices.filter(IDs=["test"])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/xero/basemanager.py", line 245, in wrapper
    raise XeroBadRequest(response)
  File "/usr/local/lib/python3.9/site-packages/xero/exceptions.py", line 53, in __init__
    self.errors = [payload["oauth_problem"][0]]
KeyError: 'oauth_problem'

The same call works fine with well-formed UUIDs:

>>> xeroc.xero.invoices.filter(IDs=["c681457b-8cac-4ba0-a67d-aaaaaaaaaaaa"])
[]

A little bit of digging seems to indicate that xero returns this (in "html" format):
Supplied parameter 'Ids' cannot be parsed - must be of type UUID.

So it seems here xero is ignoring the "Accept" header and returning a not very helpful output. But would it be possible to support this anyway?

Cheers!

@freakboy3742
Copy link
Owner

Would it be possible? Sure. Patches are welcome.

bpotard pushed a commit to bpotard/pyxero that referenced this issue Sep 14, 2023
bpotard pushed a commit to bpotard/pyxero that referenced this issue Sep 14, 2023
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

2 participants