Skip to content

Deduplicate scope error handling between api/client.go and project queries #12823

@BagToad

Description

@BagToad

After merging #12596, we now have duplicated scope error handling logic in two places:

  1. api/client.goGenerateScopeErrorForGQL + requiredScopesFromServerMessage (handles all GraphQL calls globally)
  2. pkg/cmd/project/shared/queries/queries.gohandleError + requiredScopesFromServerMessage (handles project queries specifically)

Both parse the same INSUFFICIENT_SCOPES error messages and generate the same gh auth refresh -s suggestion. The existing code already has a TODO noting this: // TODO: this duplicates parts of generateScopesSuggestion.

We should consolidate this into a single implementation in api/client.go and have queries.go call it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementa request to improve CLIhelp wantedContributions welcometech-debtA chore that addresses technical debt

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions