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 exception handling #88

Open
sharkodlak opened this issue May 11, 2023 · 1 comment
Open

Improve exception handling #88

sharkodlak opened this issue May 11, 2023 · 1 comment
Labels

Comments

@sharkodlak
Copy link

Exception can be enhanced by passing causing exception as $previous when ApiException is created. Now it's impossible to get API response body from ApiException.


Expected Behavior

I'd like to get API response body from ApiException $e.

try {
...
} catch (ApiException $e)
(string) $e->getPrevious()->getResponse()->getBody();
}

Current Behavior

It's impossible to call $e->getPrevious()->... because previous exception is't stored.

Steps to Reproduce

  1. Set editMode: $client->editMode(true);
  2. Call $client->getStories($options)->getBody(); Now ApiException is thrown, because client is unauthorized.
  3. Try to obtain serious information what's going on from ApiException $e.
@roberto-butti
Copy link
Collaborator

Thank you @sharkodlak for the valuable feedback.
Let me check it and come back to you with more information.

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

No branches or pull requests

2 participants