Skip to content

Commit 692cb27

Browse files
authored
ContainerRegistry: Fix decodingErrors parameters which were still using raw error codes (#22)
### Motivation `swift-http-types` provides enums giving readable names for HTTP error codes. We should use these enums everewhere. ### Modifications Fix a few places where raw HTTP error codes were still being used. ### Result The code is more consistent. No functional change. ### Test Plan Tests continue to pass.
1 parent bca5f51 commit 692cb27

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Sources/ContainerRegistry/Blobs.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public extension RegistryClient {
6464
do {
6565
let _ = try await executeRequestThrowing(
6666
.head(registryURLForPath("/v2/\(repository)/blobs/\(digest)")),
67-
decodingErrors: [404]
67+
decodingErrors: [.notFound]
6868
)
6969
return true
7070
} catch HTTPClientError.unexpectedStatusCode(status: .notFound, _, _) { return false }
@@ -83,7 +83,7 @@ public extension RegistryClient {
8383

8484
return try await executeRequestThrowing(
8585
.get(registryURLForPath("/v2/\(repository)/blobs/\(digest)"), accepting: ["application/octet-stream"]),
86-
decodingErrors: [404]
86+
decodingErrors: [.notFound]
8787
)
8888
.data
8989
}
@@ -106,7 +106,7 @@ public extension RegistryClient {
106106

107107
return try await executeRequestThrowing(
108108
.get(registryURLForPath("/v2/\(repository)/blobs/\(digest)"), accepting: ["application/octet-stream"]),
109-
decodingErrors: [404]
109+
decodingErrors: [.notFound]
110110
)
111111
.data
112112
}

Sources/ContainerRegistry/Tags.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public extension RegistryClient {
1818
precondition(repository.count > 0, "repository must not be an empty string")
1919
return try await executeRequestThrowing(
2020
.get(registryURLForPath("/v2/\(repository)/tags/list")),
21-
decodingErrors: [404]
21+
decodingErrors: [.notFound]
2222
)
2323
.data
2424
}

0 commit comments

Comments
 (0)