• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / supabase-swift / 29009119306

09 Jul 2026 09:42AM UTC coverage: 77.235% (-5.8%) from 83.062%
29009119306

Pull #1099

github

web-flow
Merge 78facb76f into 27f31bfb7
Pull Request #1099: feat(storage): OpenAPI codegen tool + generated Storage HTTP client

314 of 1121 new or added lines in 13 files covered. (28.01%)

52 existing lines in 2 files now uncovered.

8180 of 10591 relevant lines covered (77.24%)

33.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/Sources/HTTPRuntime/HTTPError.swift
1
//
2
//  HTTPError.swift
3
//  HTTPRuntime
4
//
5
//  Created by Guilherme Souza on 08/07/26.
6
//
7
package import Foundation
8

9
/// Errors surfaced by the runtime itself (transport/encoding/decoding), as
10
/// distinct from typed API errors decoded from a response body.
11
package enum HTTPError: Error, Sendable {
12
  case invalidURL(base: URL, path: String)
13
  case transport(any Error)
14
  case decoding(any Error)
15
  case encoding(any Error)
16
  /// A non-success status whose body did not decode to any modeled error.
17
  case unexpectedStatus(status: Int, body: Data)
18
}
19

20
/// Marker protocol for generated, typed API errors decoded from a response
21
/// body for a known status code.
22
package protocol APIError: Error, Sendable, Decodable {}
23

24
extension HTTPResponse {
25
  /// Validates the status code, decoding a modeled error when the status
26
  /// matches one of the provided error types. Generated code passes the
27
  /// `status -> ErrorType` table declared by the operation's Smithy/TypeSpec
28
  /// error bindings.
29
  package func checkStatus(errorTypes: [Int: any APIError.Type]) throws {
4✔
30
    guard !head.isSuccess else { return }
4✔
31
    if let errorType = errorTypes[head.status] {
2✔
32
      do {
1✔
33
        let decoded = try JSONCoding.decoder.decode(errorType, from: body)
1✔
34
        throw decoded
1✔
35
      } catch let error as any APIError {
1✔
36
        throw error
1✔
37
      } catch {
1✔
NEW
38
        throw HTTPError.decoding(error)
×
NEW
39
      }
×
40
    }
1✔
41
    throw HTTPError.unexpectedStatus(status: head.status, body: body)
1✔
42
  }
4✔
43
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc