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

Don't override ApiException::__toString #388

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

dasl-
Copy link

@dasl- dasl- commented May 23, 2022

Since ApiException overrides the __toString method, it does not behave as one might expect other Exception subclasses to behave. Stop overriding it so that we have more "conventional" php behavior. In particular, the backtrace will now be part of the string.

Before:

php > require 'src/ApiException.php';
php > $e = new \Google\ApiCore\ApiException('test_message', 1, 'test_status');
php > var_dump("$e");
string(42) "Google\ApiCore\ApiException: test_message
"

After:

php > $e = new \Google\ApiCore\ApiException('test_message', 1, 'test_status');
php > var_dump("$e");
string(84) "Google\ApiCore\ApiException: test_message in php shell code:1
Stack trace:
#0 {main}"

@dasl- dasl- requested review from a team as code owners May 23, 2022 17:17
@google-cla
Copy link

google-cla bot commented May 23, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

For more information, open the CLA check for this pull request.

@bshaffer bshaffer added this to the v2.0 milestone May 23, 2022
@bshaffer bshaffer added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label May 23, 2022
@bshaffer
Copy link
Contributor

This change will be made as part of our upcoming v2 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants