Fix error message in generate_github_installation_token function

This commit is contained in:
Andras Bacsai 2024-04-09 11:54:15 +02:00
parent 353245bb7d
commit 72b9001447

View File

@ -29,7 +29,7 @@ function generate_github_installation_token(GithubApp $source)
'Accept' => 'application/vnd.github.machine-man-preview+json'
])->post("{$source->api_url}/app/installations/{$source->installation_id}/access_tokens");
if ($token->failed()) {
throw new RuntimeException("Failed to get access token for " . $source->name . " with error: " . $token->json()['message']);
throw new RuntimeException("Failed to get access token for " . $source->name . " with error: " . data_get($token->json(),'message','no error message found'));
}
return $token->json()['token'];
}