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

Improve error handling #52

Open
jettdc opened this issue Oct 22, 2024 · 1 comment
Open

Improve error handling #52

jettdc opened this issue Oct 22, 2024 · 1 comment

Comments

@jettdc
Copy link

jettdc commented Oct 22, 2024

Errors are currently hard to catch, they’re not strongly typed so I had to let my code throw the error first, then find the name, then add an catch clause to check for that error name

Being able to do instance checking would be much nicer

if isinstance(e, ResourceNameAlreadyExistsError):
    ...

or at least an enum of error types per namespace:

if e.name == core.Errors.RESOURCE_NAME_ALREADY_EXISTS:
    ...

or something like:

if isResourceNameAlreadyExistsException(e):
    ...
@jsmith
Copy link
Contributor

jsmith commented Nov 29, 2024

There is ongoing work to improve error handling in both the Python SDK but also the API in general. I'll keep this FR up-to-date when this feature has been released. We'll likely be going with the first option where we subclass PalantirRPCException for each error.

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