Skip to content

Unhandled promise rejection when GitHub API query fails #1039

@kholoud512

Description

@kholoud512

Description:
Currently, if a GitHub API query fails (e.g., invalid project name, network error), the CLI throws an unhandled promise rejection or displays an unclear error.

We should catch all promise rejections and provide a friendly, descriptive error message to help the user understand the problem.

Steps to Reproduce:

  1. Install the CLI globally: (npm i -g good-first-issue)
  2. Run a query with a non-existent project: (good-first-issue thisisntarealprojectorgithuborg)

Expected Behavior:

  • The CLI should display a clear error message:

Error: Unable to fetch issues for "thisisntarealprojectorgithuborg".
Please check the project name or your network connection.

  • No unhandled promise rejection should appear.

Actual Behavior:
The CLI throws an unhandled promise rejection or crashes.

Environment:

  • Node.js >= 8.0.0
  • npm >= 5.0.0
  • OS: Any

Project version: Latest from main branch

Proposed Solution (optional):

  • Wrap all API calls in try/catch or use .catch() for promises.
  • Add descriptive error messages for common failures (invalid project, network issues, rate limits).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions