summaryrefslogtreecommitdiff
path: root/Hutch/Views/Repositories/HgRepositoryDetailViewModel.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Hutch/Views/Repositories/HgRepositoryDetailViewModel.swift')
-rw-r--r--Hutch/Views/Repositories/HgRepositoryDetailViewModel.swift19
1 files changed, 4 insertions, 15 deletions
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")
}
}