krz/hutch

an ios client for sourcehut

clone: git clone https://gitbay.org/krz/hutch.git

3c99c01ad1c0c855ef1793d4b74a9c77e7445811

verified · cmc

author: Christian Cleberg <hello@cleberg.net> · 2026-07-16T00:26:27Z

fix: stop shadowing serviceNotProvisioned classification

"No such repository or user found" matched the broad "no such" test for
.notFound, which ran first and made the .serviceNotProvisioned rule below it
unreachable. Users hitting a service they have not activated were told the
content was no longer available rather than that the account needs to enable
the service.

Order the specific check ahead of the general one.
 Hutch/Networking/SRHTError.swift | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/Hutch/Networking/SRHTError.swift b/Hutch/Networking/SRHTError.swift
index e946774..59575c5 100644
--- a/Hutch/Networking/SRHTError.swift
+++ b/Hutch/Networking/SRHTError.swift
@@ -174,12 +174,14 @@ extension Array where Element == GraphQLError {
         if containsMessage("unknown revision") || containsMessage("path not in the working tree") {
             return .unknownRevision
         }
-        if containsMessage("not found") || containsMessage("no such") || containsMessage("missing revision") {
-            return .notFound
-        }
+        // Must precede the broader "no such" check below, which would otherwise
+        // shadow this and report a provisioning failure as missing content.
         if containsMessage("no such repository or user found") {
             return .serviceNotProvisioned
         }
+        if containsMessage("not found") || containsMessage("no such") || containsMessage("missing revision") {
+            return .notFound
+        }
         if let primaryMessage, !primaryMessage.isEmpty {
             return .validation
         }