summaryrefslogtreecommitdiff
path: root/Hutch/Networking/SRHTClient.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-01 23:25:54 -0500
committerChristian Cleberg <[email protected]>2026-04-01 23:25:54 -0500
commita83893afa086f0050c825144fa818024db4df056 (patch)
treec11c90f50acc633d2388e9a4940a4f3e7662b2a6 /Hutch/Networking/SRHTClient.swift
parent7fe5ec3f69211712d39f3a1dff090119340e05d9 (diff)
downloadhutch-2.8.0.tar.gz
hutch-2.8.0.tar.bz2
hutch-2.8.0.zip
feat: add Look Up screen and restrict management actions to ownersv2.8.0
Implements: https://todo.sr.ht/~ccleberg/Hutch/4
Diffstat (limited to 'Hutch/Networking/SRHTClient.swift')
-rw-r--r--Hutch/Networking/SRHTClient.swift10
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)