Skip to content

Commit 1a42250

Browse files
Fixed handling of validation errors
1 parent d281e29 commit 1a42250

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/Github/HttpClient/Plugin/GithubExceptionThrower.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,18 @@ public function doHandleRequest(RequestInterface $request, callable $next, calla
7676
break;
7777

7878
default:
79-
$errors[] = $error['message'];
79+
if (isset($error['message'])) {
80+
$errors[] = $error['message'];
81+
}
8082
break;
8183

8284
}
8385
}
8486

85-
throw new ValidationFailedException('Validation Failed: '.implode(', ', $errors), 422);
87+
throw new ValidationFailedException(
88+
$errors ? 'Validation Failed: '.implode(', ', $errors) : 'Validation Failed',
89+
422
90+
);
8691
}
8792
}
8893

0 commit comments

Comments
 (0)