From bea08d611eeaae173a5c3e9fe14f12540d88e19f Mon Sep 17 00:00:00 2001 From: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> Date: Tue, 19 Nov 2024 13:42:33 +0100 Subject: [PATCH] Mark permission issues as downstream (#389) --- pkg/github/client/errorsourcehandling.go | 1 + pkg/github/client/errorsourcehandling_test.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/pkg/github/client/errorsourcehandling.go b/pkg/github/client/errorsourcehandling.go index e95c0470..a65c7ea3 100644 --- a/pkg/github/client/errorsourcehandling.go +++ b/pkg/github/client/errorsourcehandling.go @@ -21,6 +21,7 @@ var ( "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", + "Resource not accessible by integration", // issue with incorrectly set permissions for token/app } ) diff --git a/pkg/github/client/errorsourcehandling_test.go b/pkg/github/client/errorsourcehandling_test.go index a44fcd99..0f2ec762 100644 --- a/pkg/github/client/errorsourcehandling_test.go +++ b/pkg/github/client/errorsourcehandling_test.go @@ -74,6 +74,12 @@ func TestAddErrorSourceToError(t *testing.T) { resp: nil, expected: errorsource.DownstreamError(errors.New("API rate limit exceeded for ID 1"), false), }, + { + name: "permission error message", + err: errors.New("Resource not accessible by integration"), + resp: nil, + expected: errorsource.DownstreamError(errors.New("Resource not accessible by integration"), false), + }, } for _, tt := range tests {