-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
I have created a module which depends on gigya/drupal8 and I'm using the following API:
$responce = $helper->getGigyaApiHelper()->sendApiCall('accounts.unsubscribe', ['email' => 'zxc@zxc.zxc']);
// validate $responce and do something else
This call is throwing the following error because there's no such email registered in Gigya and prevents my code to execute "validate $responce and do something else" part:
Drupal\gigya\CmsStarterKit\GSApiException: Invalid parameter value in Drupal\gigya\CmsStarterKit\GigyaAuthRequest->send() (line 49 of /Applications/MAMP/htdocs/di-tjx-ntw-d9/web/modules/contrib/gigya-drupal/gigya/src/CmsStarterKit/GigyaAuthRequest.php).
The error is the actual error response from Gigya, but it shouldn't block me from doing something else.
I believe the code of send() method should look something like this instead:
public function send($timeout = null) {
try {
$res = parent::send($timeout);
if ($res->getErrorCode() == 0)
{
return $res;
}
}
catch (Exception $e) {
if (!empty($res->getData())) { /* Actual error response from Gigya */
throw new GSApiException($res->getErrorMessage(), $res->getErrorCode(), $res->getResponseText(), $res->getString("callId", "N/A"));
} else { /* Hard-coded error in PHP SDK, or another failure */
throw new GSException($res->getErrorMessage(), $res->getErrorCode());
}
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels