Skip to content
This repository was archived by the owner on Jan 17, 2023. It is now read-only.

Commit 1e16e62

Browse files
committed
Update the handling of Vend API Errors
It turns out that the error_description attribute on the Vend error responses is option. Add some checking to ensure that the error_description attribute is only used if it exists.
1 parent 39f1766 commit 1e16e62

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/Vend/Api/AuthenticationGateway.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,13 @@ protected function requestAccess($request)
206206
));
207207

208208
if (isset($response->error)) {
209-
throw new \RuntimeException($response->error_description);
209+
$message = $response->error;
210+
211+
if (isset($response->error_description)) {
212+
$message = $response->error_description;
213+
}
214+
215+
throw new \RuntimeException($message);
210216
}
211217

212218
return $response;

0 commit comments

Comments
 (0)