Skip to content

Fix exceptions classes#81

Merged
robertdimarco merged 2 commits intogoogleapis:masterfrom
Maks3w:fix-exceptions-classes
Jun 16, 2016
Merged

Fix exceptions classes#81
robertdimarco merged 2 commits intogoogleapis:masterfrom
Maks3w:fix-exceptions-classes

Conversation

@Maks3w
Copy link
Copy Markdown

@Maks3w Maks3w commented Jan 17, 2016

Use InvalidArgumentException when $allowed_algs is not array

Exception thrown if an argument is not of the expected type.
http://php.net/manual/en/class.invalidargumentexception.php

Use RuntimeExceptions for exceptions related with unencoded data.

RuntimeExceptions is the correct exception error source is the decoded data.

Note LogicExceptions as defined in PHP documentation implies a modification in the code by the developer.

Exception that represents error in the program logic. This kind of exception should lead directly to a fix in your code.
http://php.net/manual/en/class.logicexception.php

But the token is a data provided by an external source which is out side of the control of the developer so there is no way of prevent malformed tokens.

try {} catch (\Exception) {} // Incorrect

try {} catch (\RuntimeException) {} // Correct

RuntimeExceptions is the correct exception error source is the decoded data.

Note LogicExceptions as defined in PHP documentation implies a modification in the code by the developer.

> Exception that represents error in the program logic. This kind of exception should lead directly to a fix in your code.
http://php.net/manual/en/class.logicexception.php

But the token is a data provided by an external source which is out side of the control of the developer so there is no way of prevent malformed tokens.
@googlebot
Copy link
Copy Markdown

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).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@googlebot googlebot added the cla: no This human has *not* signed the Contributor License Agreement. label Jan 17, 2016
@Maks3w
Copy link
Copy Markdown
Author

Maks3w commented Jan 17, 2016

I won't sign any kind of CLA. This contribution is free of any kind of right I could have.

@robertdimarco
Copy link
Copy Markdown

Great stuff! Happy to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: no This human has *not* signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants