You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 29, 2019. It is now read-only.
The API has been giving non-standard errors recently (e.g. endpoint 404), which has highlighted that the library doesn't handle such "unknown errors" gracefully (it throws an array_key_exists() notice). Also, there isn't a code for APIUnreachableError...
Suggest the following change to the makeRequest() method in oauth_application.php:
if (!$resp) {
$msg = 'Unable to connect to the AWeber API. (' . $this->error . ')';
$error = array('status' => '521', 'message' => $msg, 'type' => 'APIUnreachableError',
'documentation_url' => 'https://labs.aweber.com/docs/troubleshooting');
throw new AWeberAPIException($error, $url);
}
if($resp->headers['Status-Code'] >= 400) {
$data = json_decode($resp->body, true);
if (isset($data['error'])) {
throw new AWeberAPIException($data['error'], $url);
} else {
$msg = 'Unexpected error from AWeber API. (' . $resp->headers['Status'] . ')';
$error = array('status' => '520', 'message' => $msg, 'type' => 'APIUnknownError',
'documentation_url' => 'https://labs.aweber.com/docs/troubleshooting');
throw new AWeberAPIException($error, $url);
}
}
The API has been giving non-standard errors recently (e.g. endpoint 404), which has highlighted that the library doesn't handle such "unknown errors" gracefully (it throws an array_key_exists() notice). Also, there isn't a code for APIUnreachableError...
Suggest the following change to the makeRequest() method in oauth_application.php:
Cheers
Rob
Ps - The 520/521 status codes were chosen as they correspond closely to existing "unofficial" codes:
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#CloudFlare
The text was updated successfully, but these errors were encountered: