Skip to content

Commit 2afb40c

Browse files
committed
fixed php warning in GithubExceptionThrower
fixes ``` Warning: Illegal string offset 'code' in GithubExceptionThrower.php on line 59 ``` when deleting a deployment which is not yet set to inactive
1 parent 90e695e commit 2afb40c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/Github/HttpClient/Plugin/GithubExceptionThrower.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ public function doHandleRequest(RequestInterface $request, callable $next, calla
5959
if (422 === $response->getStatusCode() && isset($content['errors'])) {
6060
$errors = [];
6161
foreach ($content['errors'] as $error) {
62-
switch ($error['code']) {
62+
$code = null;
63+
if (isset($error['code'])) {
64+
$code = $error['code'];
65+
}
66+
67+
switch ($code) {
6368
case 'missing':
6469
$errors[] = sprintf('The %s %s does not exist, for resource "%s"', $error['field'], $error['value'], $error['resource']);
6570
break;

0 commit comments

Comments
 (0)