Skip to content

🔌 Improve GitHub API error handling #70

@jordanpartridge

Description

@jordanpartridge

Problem

All GitHub API failures return null silently, making it hard to distinguish between auth failures, rate limits, and transient errors.

Current Behavior

File: app/GitHub/ChecksClient.php:90-93

} catch (GuzzleException $e) {
    $this->logError('createCheck', $e);
    return null;
}

Expected Behavior

Differentiate between error types with specific messages.

Proposed Implementation

} catch (GuzzleException $e) {
    if ($e->getCode() === 401) {
        throw new \RuntimeException("GitHub token invalid or expired");
    }
    if ($e->getCode() === 403 && str_contains($e->getMessage(), 'rate limit')) {
        throw new \RuntimeException("GitHub API rate limit exceeded");
    }
    $this->logError('createCheck', $e);
    return null;
}

Benefits

  • Better error messages for common issues
  • Helps users fix auth problems quickly
  • Distinguishes between retryable and permanent failures

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    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