Skip to content

Commit 1466f16

Browse files
Improve the 404 friendly message (#363)
Doing some clarifying wording in the friendly error message that we add to a 404 to indicate that they could be getting the error because the item truly doesn't exist, not simply due to authentication issues.
1 parent 9aac697 commit 1466f16

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

GitHubCore.ps1

+7-2
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,13 @@ function Invoke-GHRestMethod
550550

551551
if ($statusCode -eq 404)
552552
{
553-
$explanation = @('This typically happens when the current user isn''t properly authenticated.',
554-
'You may need an Access Token with additional scopes checked.')
553+
$explanation = @('This error will usually happen for one of the following reasons:',
554+
'(1) The item you are requesting truly doesn''t exist (so make sure you don''t have',
555+
'a typo) or ',
556+
'(2) The item _does_ exist, but you don''t currently have permission to access it. ',
557+
'If you think the item does exist and that you _should_ have access to it, then make',
558+
'sure that you are properly authenticated with Set-GitHubAuthentication and that',
559+
'your access token has the appropriate scopes checked.')
555560
$output += ($explanation -join ' ')
556561
}
557562

0 commit comments

Comments
 (0)