-
Notifications
You must be signed in to change notification settings - Fork 28
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 error handling and logic #58
Improve error handling and logic #58
Commits on Mar 16, 2023
-
Change URL formatting for ACF, GF, WPML
Use `http_build_query()` to improve readability and reduce risk of errors.
Configuration menu - View commit details
-
Copy full SHA for 23e7a41 - Browse repository at this point
Copy the full SHA 23e7a41View commit details -
Change HTTP request method for ACF-E, GF, PLL
Use GET instead of POST to better match the verb to the request and for consistency between downloaders.
Configuration menu - View commit details
-
Copy full SHA for 2810340 - Browse repository at this point
Copy the full SHA 2810340View commit details -
Changed: - Throw `InvalidArgumentException` instead of `UnexpectedValueException` when dealing with an unsupported package in Ninja Forms, PublishPress Pro, and WPML. - Throw `UnexpectedValueException` if the decoded/unserialized API response is not an array. - Improved messages to clarify errors from API. - Fixed and improved PHPDoc tags to document exceptions.
Configuration menu - View commit details
-
Copy full SHA for 7d3aa9e - Browse repository at this point
Copy the full SHA 7d3aa9eView commit details -
Changed: - Use booleans intead of integers for cURL options. - Compile URL in GET request earlier to organize cURL options similarly to POST request.
Configuration menu - View commit details
-
Copy full SHA for 0b1c8af - Browse repository at this point
Copy the full SHA 0b1c8afView commit details -
Improve
Http
class request and response handlingChanged: - Added protected method `request()` to aggregate the execution of the request, handling of the response, and closing of the cURL handler. - Added cURL option `CURLOPT_FAILONERROR` to fail if the response is >= 400. - Throw `RuntimeException ` if the request failed. - Fixed and improved PHPDoc tags.
Configuration menu - View commit details
-
Copy full SHA for fb0c1ab - Browse repository at this point
Copy the full SHA fb0c1abView commit details -
Refactor plugin abstraction and Http usage
Changed: - Replaced `getDownloadUrl()` in EDD plugins with a new protected method `getDownloadUrlFromApi()` that only handles the request for the download URL response object. - Replaced `extractDownloadUrl()` with `getDownloadUrl()` in `AbstractEddPlugin` that retrieves the response to parse from the plugin's `getDownloadUrlFromApi()`. - Wrapped requests with `Http` in a try/catch to intercept cURL exceptions and wrap them in a plugin-aware exception.
Configuration menu - View commit details
-
Copy full SHA for cee1cf5 - Browse repository at this point
Copy the full SHA cee1cf5View commit details
Commits on Jun 9, 2023
-
Remove default value for
$url
arguments inHttp
classA URL is necessary for requests.
Configuration menu - View commit details
-
Copy full SHA for 24eb239 - Browse repository at this point
Copy the full SHA 24eb239View commit details -
Update block comments in
AbstractPlugin
Changed: - Removed extraneous property descriptions. - Rephrased description of `$slug` property to be more specific. - Added missing `$slug` method parameter.
Configuration menu - View commit details
-
Copy full SHA for 1e8f528 - Browse repository at this point
Copy the full SHA 1e8f528View commit details -
Fix HTTP request method for ACF-Extended
Amends cee1cf5 Accidentally reverted back from GET to POST.
Configuration menu - View commit details
-
Copy full SHA for 378ade7 - Browse repository at this point
Copy the full SHA 378ade7View commit details -
Decouple API URL and query parameters
Decoupled API URL and API URL query parameters from its HTTP query building and URL concatenation, and HTTP request call. This allows the base URL and query parameters to be more readable from their final concatenated URL or HTTP request call.
Configuration menu - View commit details
-
Copy full SHA for efdb917 - Browse repository at this point
Copy the full SHA efdb917View commit details -
Decouple version from API URL query parameters and version check
This ensures compatibility with the classes' `$version` property being potentially empty, presuming a request for the latest version.
Configuration menu - View commit details
-
Copy full SHA for e667513 - Browse repository at this point
Copy the full SHA e667513View commit details -
Add
getPackageName()
method toAbstractPlugin
To reduce repetition, and risk of mistakes, when formatting the plugin's Composer package name. The package name is used in the messaging of most exceptions thrown. Storing vendor name as a namespace
Configuration menu - View commit details
-
Copy full SHA for f4ad7ec - Browse repository at this point
Copy the full SHA f4ad7ecView commit details -
Changed: - Moved shared cURL options to `request()` method. - Catch any exception from `Http` requests.
Configuration menu - View commit details
-
Copy full SHA for fa45ae8 - Browse repository at this point
Copy the full SHA fa45ae8View commit details -
Improve error handling for EDD plugins
Separated JSON decoding error handling from HTTP request/response error handling. By using `json_last_error()`, we can provide a more precise error for end users as opposed to just checking if its an array. Output a truncated excerpt of the response body if JSON decoding fails to give a hint of what the issue might be.
Configuration menu - View commit details
-
Copy full SHA for 134926b - Browse repository at this point
Copy the full SHA 134926bView commit details -
Improve error handling for Gravity Forms
Separated unserialization error handling from HTTP request/response error handling. Wrapped unserialization in try/catch to intercept any throwables from unexpected objects in their unserialization handlers. Gravity Forms is supposed to return an associative array but could be compromised. Output a truncated excerpt of the response body if unserialization fails to give a hint of what the issue might be. Ideally, add an error handler to catch the PHP notice that is raised by `unserialize()`.
Configuration menu - View commit details
-
Copy full SHA for ab73a24 - Browse repository at this point
Copy the full SHA ab73a24View commit details