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

feat: Throw an InvalidRequest whenever a curl request fails #103

Merged

Conversation

colinodell
Copy link
Contributor

@colinodell colinodell commented Oct 2, 2018

Fixes #90

This is one of three possible solutions to #90. #104 is similar but doesn't use catchable exceptions, and #105 is more about avoiding the issue than notifying the user.

Checklist

  • I have made a material change to the repo (functionality, testing, spelling, grammar)
  • I have read the [Contribution Guide] and my PR follows them.
  • I updated my branch with the master branch.
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation about the functionality in the appropriate .md file
  • I have added in line documentation to the code I modified

Short description of what this PR does:

  • An exception will be thrown if a curl request fails due to something like SSL verification (BC break)
  • Uses composer/ca-bundle (if installed) to locate the system's CA bundle or fall back to Mozilla's (Support composer/ca-bundle fallback #105)

@thinkingserious thinkingserious added the status: code review request requesting a community code review or review from Twilio label Oct 2, 2018
@SendGridDX
Copy link

SendGridDX commented Oct 2, 2018

CLA assistant check
All committers have signed the CLA.

@thinkingserious
Copy link
Contributor

Hello @colinodell,

I like this solution combined with #105. What do you see as the cons of choosing this solution to #104?

Thanks!

With Best Regards,

Elmer

@thinkingserious thinkingserious added status: waiting for feedback waiting for feedback from the submitter and removed status: code review request requesting a community code review or review from Twilio labels Oct 3, 2018
@colinodell
Copy link
Contributor Author

Hey Elmer,

I strongly prefer this option because any issues result in thrown exceptions which can be caught and dealt with. The alternate approach in #104 cannot be caught and handled by anyone using this library, it just provides a better error message instead of failing silently.

The only potential con is that this is technically a backward-compatibility break as users of this library may not be expecting any exceptions to be thrown, so you'll probably want to bump the major version of this library if you're following semver. Despite this, I do think this approach is best way forward and it aligns with how other API libraries also throw expections when issues occur.

@thinkingserious
Copy link
Contributor

Thanks @colinodell,

I agree with you. Please fold #105 into this PR. Thanks!

@colinodell
Copy link
Contributor Author

Done! I have also added some documentation via 281048f

@thinkingserious thinkingserious added status: code review request requesting a community code review or review from Twilio hacktoberfest difficulty: medium fix is medium in difficulty type: twilio enhancement feature request on Twilio's roadmap and removed status: waiting for feedback waiting for feedback from the submitter labels Oct 5, 2018
@thinkingserious
Copy link
Contributor

Hello @colinodell,

Thanks again for the PR!

It's HACKTOBERFEST! We want to show our appreciation by sending you some special Hacktoberfest swag. If you have not already, could you please fill out this form so we can send it to you? Thanks!

Team SendGrid DX

@colinodell
Copy link
Contributor Author

Done! Thanks for letting me know about that, I appreciate it!

@thinkingserious
Copy link
Contributor

Hello @colinodell,

Thanks again for the PR!

We noticed that you have earned 3 out of the 5 points needed to receive glorious SendGrid Hacktoberfest swag.

Please take a moment to checkout this link to find more issues to get you past the required threshold.

Also, please be sure that you have officially registered here.

Thank you and Happy Hacktobering!

Team SendGrid DX

@thinkingserious
Copy link
Contributor

Hello @colinodell,

Thanks again for the PR!

You have earned 3 out of the 5 points needed to receive glorious SendGrid Hacktoberfest swag.

Please take a moment to checkout this link to find more issues to get you past the required threshold or to simply continue the celebration.

Also, please be sure you have officially registered with us here by November 1, 2018 to qualify.

If you have any questions you can email us at [email protected].

Thank you and Happy Hacktobering!

Team SendGrid

@alextech
Copy link
Contributor

alextech commented Nov 9, 2018

Is this the same or conflict with what I already have done at #99 ?

@childish-sambino childish-sambino removed the type: twilio enhancement feature request on Twilio's roadmap label Jul 20, 2020
@thinkingserious thinkingserious changed the base branch from master to main July 28, 2020 14:38
@childish-sambino childish-sambino changed the title Throw a \RuntimeException whenever a curl request fails (#90) feat: Throw a \RuntimeException whenever a curl request fails Oct 12, 2020
Copy link
Contributor

@childish-sambino childish-sambino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@childish-sambino childish-sambino changed the title feat: Throw a \RuntimeException whenever a curl request fails feat: Throw an InvalidRequest whenever a curl request fails Oct 12, 2020
@childish-sambino childish-sambino merged commit e36e168 into sendgrid:main Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: medium fix is medium in difficulty status: code review request requesting a community code review or review from Twilio
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document and throw an error to help people with CURLOPT_SSL_VERIFYPEER issues
5 participants