From 5e63048ab6a741ae947f7fe42efcb5206a3f3963 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Mon, 13 Apr 2026 14:20:27 -0500 Subject: fix: mercurial parity and graphql handling - implements consistent UX between repo types - ensures centralized services and routes are used between repo types - graphql error handling is centralized - error messages are consistent Implements: https://todo.sr.ht/~ccleberg/hutch/58 Implements: https://todo.sr.ht/~ccleberg/hutch/59 --- .../Repositories/HgRepositoryDetailViewModel.swift | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'Hutch/Views/Repositories/HgRepositoryDetailViewModel.swift') diff --git a/Hutch/Views/Repositories/HgRepositoryDetailViewModel.swift b/Hutch/Views/Repositories/HgRepositoryDetailViewModel.swift index 5a0298c..d8303e1 100644 --- a/Hutch/Views/Repositories/HgRepositoryDetailViewModel.swift +++ b/Hutch/Views/Repositories/HgRepositoryDetailViewModel.swift @@ -526,20 +526,9 @@ final class HgRepositoryDetailViewModel { } private func isEmptyRepositoryError(_ error: Error) -> Bool { - if let srhtError = error as? SRHTError, - case .graphQLErrors(let errors) = srhtError { - return errors.contains { - let message = $0.message.localizedLowercase - return message.contains("missing") - || message.contains("not found") - || message.contains("unknown revision") - || message.contains("unknown revision or path not in the working tree") - } - } - - let message = error.localizedDescription.localizedLowercase - return message.contains("missing") - || message.contains("not found") - || message.contains("unknown revision") + error.matchesGraphQLErrorClassification(.notFound) + || error.matchesGraphQLErrorClassification(.unknownRevision) + || error.matchesGraphQLErrorClassification(.noRows) + || error.containsGraphQLErrorMessage("missing") } } -- cgit v1.2.3