Build iOS App / Build .ipa and publish source (push) Failing after 35s
Multi-repo PR inbox, review (approve/request changes/comment), merge with gating toggle, read-only diff viewer, and Gitea Actions check status with one-tap re-run. Ships unsigned via the iMac runner to the SideStore source.
33 lines
1021 B
Swift
33 lines
1021 B
Swift
import Foundation
|
|
|
|
enum APIError: LocalizedError, Equatable {
|
|
case invalidURL
|
|
case invalidResponse
|
|
case httpStatus(Int, String?)
|
|
case decoding(String)
|
|
case unauthorized
|
|
case notFound
|
|
|
|
var errorDescription: String? {
|
|
switch self {
|
|
case .invalidURL:
|
|
return "The instance URL is invalid."
|
|
case .invalidResponse:
|
|
return "The server returned an invalid response."
|
|
case .httpStatus(let code, let message):
|
|
if code == 401 || code == 403 {
|
|
return "Authentication failed. Check your token."
|
|
}
|
|
return message?.isEmpty == false
|
|
? "Server error (\(code)): \(message!)"
|
|
: "Server error (\(code))."
|
|
case .decoding(let detail):
|
|
return "Could not parse the server response: \(detail)"
|
|
case .unauthorized:
|
|
return "Authentication failed. Check your token."
|
|
case .notFound:
|
|
return "Not found."
|
|
}
|
|
}
|
|
}
|