Skip to content

Commit 141d119

Browse files
Show more errors on player search
Was previously only showing bungie maintenance errors, but this was insufficient as it's possible for the API to be down but not in maintenance mode (as we saw yesterday). Also, this will allow users to see when e.g. their network connection is preventing searches from completing. My original intention for not showing errors was to avoid showing messages every single time a user inputs a bad name as its intuitive that a search which doesn't result in the button being enabled did not return results; a message is unneeded. But really I should have always checked specifically for the errors we want to avoid and let others through. So my b.
1 parent 90ade0c commit 141d119

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Fabled/Sources/PlayerSearchViewController.swift

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import UIKit
22
import Model
3-
import PromiseKit
3+
import PMKFoundation
44

55
final class PlayerSearchViewController: DeclarativeViewController, RootPresentationViewControllerDelegate {
66
private let playerSearchPlatform = State(initialValue: Platform.all)
@@ -118,8 +118,12 @@ final class PlayerSearchViewController: DeclarativeViewController, RootPresentat
118118
.done { self.player.binding.emit($0.first) }
119119
.ensure { self.playerSearchActivityIndicator.stopAnimating() }
120120
.catch {
121-
guard let error = $0 as? Bungie.Error, error == .systemDisabledForMaintenance else { return }
122-
self.presentationShouldDisplayAlert(for: error)
121+
switch $0 {
122+
case let .badStatusCode(code, _, _) as PMKHTTPError where code == 400:
123+
break //Ignore failed searches due unexpected character entry
124+
default:
125+
self.presentationShouldDisplayAlert(for: $0)
126+
}
123127
}
124128
}
125129

0 commit comments

Comments
 (0)