fix(api): code:nil bei AuthError.serverError-Calls
Anpassung an die neue ManaCore-Signatur `AuthError.serverError(status:code:message:)` (vorher ohne `code`). Drei Call-Sites in fetchMedia, deleteMedia und ensureOK. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6805bd78c7
commit
710ede6acd
1 changed files with 3 additions and 3 deletions
|
|
@ -170,7 +170,7 @@ actor CardsAPI {
|
|||
func fetchMedia(id: String) async throws -> Data {
|
||||
let (data, http) = try await transport.request(path: "/api/v1/media/\(id)")
|
||||
guard (200 ..< 300).contains(http.statusCode) else {
|
||||
throw AuthError.serverError(status: http.statusCode, message: "media fetch failed")
|
||||
throw AuthError.serverError(status: http.statusCode, code: nil, message: "media fetch failed")
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
|
@ -178,7 +178,7 @@ actor CardsAPI {
|
|||
/// `DELETE /api/v1/media/:id` — Soft-Forget. (Endpoint heute nicht
|
||||
/// implementiert serverseitig; Stub bleibt für späteren Use.)
|
||||
func deleteMedia(id _: String) async throws {
|
||||
throw AuthError.serverError(status: 501, message: "media delete not implemented on server")
|
||||
throw AuthError.serverError(status: 501, code: nil, message: "media delete not implemented on server")
|
||||
}
|
||||
|
||||
// MARK: - Deck-Mutations
|
||||
|
|
@ -326,7 +326,7 @@ actor CardsAPI {
|
|||
private func ensureOK(_ http: HTTPURLResponse, data: Data) throws {
|
||||
guard (200 ..< 300).contains(http.statusCode) else {
|
||||
let message = (try? JSONDecoder().decode(CardsServerError.self, from: data))?.error
|
||||
throw AuthError.serverError(status: http.statusCode, message: message)
|
||||
throw AuthError.serverError(status: http.statusCode, code: nil, message: message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue