Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Fix error source for saml error and limit error #367

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/github/client/errorsourcehandling.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ var (
downstreamErrors = []string{
"Could not resolve to",
"Your token has not been granted the required scopes to execute this query",
"Resource protected by organization SAML enforcement. You must grant your Personal Access token access to this organization.",
"API rate limit exceeded",
}
)

Expand Down
14 changes: 13 additions & 1 deletion pkg/github/client/errorsourcehandling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,19 @@ func TestAddErrorSourceToError(t *testing.T) {
name: "context canceled error",
err: context.Canceled,
resp: nil,
expected: errorsource.DownstreamError( context.Canceled, false),
expected: errorsource.DownstreamError(context.Canceled, false),
},
{
name: "saml error message",
err: errors.New("Resource protected by organization SAML enforcement. You must grant your Personal Access token access to this organization."),
resp: nil,
expected: errorsource.DownstreamError(errors.New("Resource protected by organization SAML enforcement. You must grant your Personal Access token access to this organization."), false),
},
{
name: "limit exceeded error message",
err: errors.New("API rate limit exceeded for ID 1"),
resp: nil,
expected: errorsource.DownstreamError(errors.New("API rate limit exceeded for ID 1"), false),
},
}

Expand Down
Loading