2026-03-11 14:44:19 -07:00
|
|
|
import Foundation
|
|
|
|
|
|
|
|
|
|
enum SeedError: LocalizedError {
|
|
|
|
|
case missingArguments
|
|
|
|
|
case dockerExecFailed(command: String, exitCode: Int32, stderr: String)
|
2026-06-09 03:55:45 -07:00
|
|
|
case dockerExecTimedOut(command: String, seconds: TimeInterval)
|
2026-03-11 14:44:19 -07:00
|
|
|
case retryExhausted(operation: String, attempts: Int)
|
|
|
|
|
|
|
|
|
|
var errorDescription: String? {
|
|
|
|
|
switch self {
|
|
|
|
|
case .missingArguments:
|
|
|
|
|
"Usage: forgejo-seed <base-url> <service-name> [compose-file]"
|
|
|
|
|
case let .dockerExecFailed(command, exitCode, stderr):
|
|
|
|
|
"Docker exec failed (\(exitCode)): \(command)\n\(stderr)"
|
2026-06-09 03:55:45 -07:00
|
|
|
case let .dockerExecTimedOut(command, seconds):
|
|
|
|
|
"Docker exec timed out after \(Int(seconds))s: \(command)"
|
2026-03-11 14:44:19 -07:00
|
|
|
case let .retryExhausted(operation, attempts):
|
|
|
|
|
"\(operation) failed after \(attempts) attempts"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|