Skip to content

Better errors for invalid manager actions #46

@daleal

Description

@daleal

Right now, when a user tries to use an invalid action on a manager, the error returned is really bad (basically, there is no checking for invalid actions). For example, trying to get an invoice returns the following error:

Traceback (most recent call last):
  File "dist/main.py", line 16, in <module>
    invoice = link.invoices.get("inv_e7Qn499tZ6x14BW3")
  File "/home/epsilon/documents/work/fintoc/fintoc-python/fintoc/utils.py", line 71, in wrapper
    raise error(error_data["error"]) from None
fintoc.errors.InvalidRequestError: invalid_request_error: unrecognized_request
Unrecognized request: GET /v1/invoices/inv_e7Qn499tZ6x14BW3?link_token=link_5Vw1GBZiRaxGpORl_token_4aTYpCwxKRKcAntvHqHe4mTx. Please see https://docs.fintoc.com/ for valid routes.

This might be because the action validation is done through a __getattr__. The SDK should probably work similar to how the Node SDK works (have a method for each action and check on that method).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions