Skip to content

fix: Check for cURL error before throwing exception in sendRequest method #130

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

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

mzaman
Copy link
Contributor

@mzaman mzaman commented Mar 25, 2024

Description:

This commit addresses an issue where an exception was being thrown unconditionally in the sendRequest method of the MatomoTracker class when a cURL request failed. The error handling logic now checks if curl_error($ch) returns a non-empty value before throwing a \RuntimeException. This ensures that exceptions are only thrown when there is an actual cURL error, preventing unnecessary exceptions from being raised. This change improves error handling and provides more accurate feedback when cURL requests fail.

…thod

Description:
This commit addresses an issue where an exception was being thrown unconditionally in the `sendRequest` method of the `MatomoTracker` class when a cURL request failed. The error handling logic now checks if `curl_error($ch)` returns a non-empty value before throwing a `\RuntimeException`. This ensures that exceptions are only thrown when there is an actual cURL error, preventing unnecessary exceptions from being raised. This change improves error handling and provides more accurate feedback when cURL requests fail.
@sgiehl sgiehl merged commit 041e931 into matomo-org:master Mar 25, 2024
@mzaman mzaman deleted the feature/curl_error branch March 25, 2024 16:34
@mzaman
Copy link
Contributor Author

mzaman commented Mar 25, 2024

Hi @sgiehl
Thank you for accepting the PR! Your collaboration is greatly appreciated.

@sgiehl sgiehl changed the title fix: Check for cURL error before throwing exception in sendRequest me… fix: Check for cURL error before throwing exception in sendRequest method Apr 8, 2024
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

Successfully merging this pull request may close these issues.

2 participants