src/main/kotlin/org/jetbrains/teamcity/github/action/DeleteWebHookAction.kt [58:71]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - } catch(e: RequestException) { LOG.warnAndDebugDetails("Failed to delete webhook for repository ${info.id}: ${e.status}", e) // TODO: There was not handel for 401. Investigate context.handleCommonErrors(e) when (e.status) { 403, 404 -> { // ? No access // "X-Accepted-OAuth-Scopes" -> "admin:repo_hook, public_repo, repo" val pair = TokensHelper.getHooksAccessType(client) ?: throw GitHubAccessException(GitHubAccessException.Type.NoAccess)// Weird. No header? if (pair.first < TokensHelper.HookAccessType.ADMIN) throw GitHubAccessException(GitHubAccessException.Type.TokenScopeMismatch, "Required scope 'admin:repo_hook', 'public_repo' or 'repo'") throw GitHubAccessException(GitHubAccessException.Type.UserHaveNoAccess) } } throw e - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - src/main/kotlin/org/jetbrains/teamcity/github/action/DeleteWebHookAction.kt [81:94]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - } catch(e: RequestException) { LOG.warnAndDebugDetails("Failed to delete webhook for repository ${info.id}: ${e.status}", e) // TODO: There was not handel for 401. Investigate context.handleCommonErrors(e) when (e.status) { 403, 404 -> { // ? No access // "X-Accepted-OAuth-Scopes" -> "admin:repo_hook, public_repo, repo" val pair = TokensHelper.getHooksAccessType(client) ?: throw GitHubAccessException(GitHubAccessException.Type.NoAccess)// Weird. No header? if (pair.first < TokensHelper.HookAccessType.ADMIN) throw GitHubAccessException(GitHubAccessException.Type.TokenScopeMismatch, "Required scope 'admin:repo_hook', 'public_repo' or 'repo'") throw GitHubAccessException(GitHubAccessException.Type.UserHaveNoAccess) } } throw e - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -