Skip to content

Enhancement: Improve error handling for reviewer assignment #17

@Philipp0205

Description

@Philipp0205

Description

The error handling when adding reviewers needs improvement. Currently, when attempting invalid operations (like adding yourself as a reviewer when you're the PR creator), the user experiences poor UX with duplicate error popups.

Current Behavior

When trying to add yourself as a reviewer (when you're also the PR creator):

  • Two error popups are displayed (duplicate error reporting)
  • Error message shown:
    Failed to add yourself as reviewer
    GitHub API request failed: HTTP 422 - {"message":"Review cannot be requested from pull request author.","documentation_url":"https://docs.github.com/rest/pulls/review-requests#request-reviewers-for-a-pull-request","status":"422"}
    

Proposed Improvements

1. Client-Side Validation

  • Validate before making API calls that the user is not trying to add themselves as a reviewer
  • Check if the reviewer username matches the PR author
  • Show a single, user-friendly error message without making the API call

2. Consolidated Error Handling

  • Eliminate duplicate error popups
  • Show only one error dialog per failed operation
  • Review error handling flow to prevent cascading errors

3. User-Friendly Error Messages

  • Transform API error responses into clearer, actionable messages
  • Example: "You cannot add yourself as a reviewer on your own pull request"
  • Remove technical details (HTTP codes, JSON responses) from user-facing messages
  • Optionally: Log technical details for debugging purposes

4. Additional Validations to Consider

  • Check if reviewer is already assigned before attempting to add
  • Validate that the user exists and has appropriate permissions
  • Handle other common API error scenarios gracefully

Benefits

  • Better user experience with clear, actionable error messages
  • Reduced API calls by validating before requests
  • Single, consistent error notification instead of duplicates
  • Less confusion for users

Technical Details

  • Location: Reviewer assignment logic (likely in internal.ui package)
  • Related: GitHub API error response handling
  • Error code: HTTP 422 from GitHub API

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions