diff options
Diffstat (limited to 'Hutch/Networking')
| -rw-r--r-- | Hutch/Networking/SRHTClient.swift | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Hutch/Networking/SRHTClient.swift b/Hutch/Networking/SRHTClient.swift index ddbd97f..1b8b9b3 100644 --- a/Hutch/Networking/SRHTClient.swift +++ b/Hutch/Networking/SRHTClient.swift @@ -98,6 +98,11 @@ final class SRHTClient: Sendable { } } + if let errorEnvelope = try? decoder.decode(GraphQLResponse<EmptyData>.self, from: data), + let errors = errorEnvelope.errors, !errors.isEmpty { + throw SRHTError.graphQLErrors(errors) + } + // Decode GraphQL response envelope let graphQLResponse: GraphQLResponse<T> do { @@ -248,6 +253,11 @@ final class SRHTClient: Sendable { } } + if let errorEnvelope = try? decoder.decode(GraphQLResponse<EmptyData>.self, from: data), + let errors = errorEnvelope.errors, !errors.isEmpty { + throw SRHTError.graphQLErrors(errors) + } + let graphQLResponse: GraphQLResponse<T> do { graphQLResponse = try decoder.decode(GraphQLResponse<T>.self, from: data) |
