summaryrefslogtreecommitdiff
path: root/octosentry/GitHubAPIError.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-07-17 16:06:47 -0500
committerChristian Cleberg <[email protected]>2026-07-17 16:06:47 -0500
commitd8862a9b78b0d6cf4e11cf537be7678794e08811 (patch)
tree4af615370bb122e6706bbefc6deaa044e02b477b /octosentry/GitHubAPIError.swift
downloadoctosentry-d8862a9b78b0d6cf4e11cf537be7678794e08811.tar.gz
octosentry-d8862a9b78b0d6cf4e11cf537be7678794e08811.tar.bz2
octosentry-d8862a9b78b0d6cf4e11cf537be7678794e08811.zip
Scaffold octosentry MVP: unified GitHub security alert feed0.1.0
MenuBarExtra popover aggregating Dependabot, code scanning, and secret scanning alerts for a single repo into one severity-ranked stream. Swift 6 strict concurrency, zero third-party dependencies, PAT-via-env-var auth as a dev-only shortcut ahead of the device authorization flow.
Diffstat (limited to 'octosentry/GitHubAPIError.swift')
-rw-r--r--octosentry/GitHubAPIError.swift41
1 files changed, 41 insertions, 0 deletions
diff --git a/octosentry/GitHubAPIError.swift b/octosentry/GitHubAPIError.swift
new file mode 100644
index 0000000..7baf918
--- /dev/null
+++ b/octosentry/GitHubAPIError.swift
@@ -0,0 +1,41 @@
+//
+// GitHubAPIError.swift
+// octosentry
+//
+
+import Foundation
+
+enum GitHubAPIError: Error, LocalizedError, Sendable {
+ case missingToken
+ case network(String)
+ case invalidResponse
+ case unauthorized
+ case forbidden
+ case notFound
+ case rateLimited
+ case httpError(status: Int)
+ case decodingFailed(String)
+
+ var errorDescription: String? {
+ switch self {
+ case .missingToken:
+ "No GitHub token found in the GITHUB_TOKEN environment variable."
+ case .network(let message):
+ "Network error: \(message)"
+ case .invalidResponse:
+ "Received an unexpected response from GitHub."
+ case .unauthorized:
+ "GitHub rejected the token (401 Unauthorized)."
+ case .forbidden:
+ "Token lacks permission for this alert type (403 Forbidden)."
+ case .notFound:
+ "Repository or endpoint not found (404)."
+ case .rateLimited:
+ "GitHub API rate limit exceeded (429)."
+ case .httpError(let status):
+ "GitHub API returned HTTP \(status)."
+ case .decodingFailed(let message):
+ "Failed to parse GitHub API response: \(message)"
+ }
+ }
+}