Skip to content

Commit d215a2a

Browse files
magicmonkzaher
authored andcommitted
When importing a user list or image, the app was modified when the user failed to import the user due to a network error.
1 parent 5699fea commit d215a2a

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

RxExample/RxExample/Examples/TableViewWithEditingCommands/DetailViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class DetailViewController: ViewController {
3333
UIImage(data: data)
3434
}
3535
.observeOn($.mainScheduler)
36+
.catchErrorJustReturn(nil)
3637
.subscribe(imageView.rx.image)
3738
.disposed(by: disposeBag)
3839

RxExample/RxExample/Examples/TableViewWithEditingCommands/TableViewWithEditingCommandsViewController.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ class TableViewWithEditingCommandsViewController: ViewController, UITableViewDel
7676
)
7777

7878
let loadFavoriteUsers = RandomUserAPI.sharedAPI
79-
.getExampleUserResultSet()
80-
.map(TableViewEditingCommand.setUsers)
79+
.getExampleUserResultSet()
80+
.map(TableViewEditingCommand.setUsers)
81+
.catchErrorJustReturn(TableViewEditingCommand.setUsers(users: []))
8182

8283
let initialLoadCommand = Observable.just(TableViewEditingCommand.setFavoriteUsers(favoriteUsers: [superMan, watMan]))
8384
.concat(loadFavoriteUsers)
@@ -104,10 +105,6 @@ class TableViewWithEditingCommandsViewController: ViewController, UITableViewDel
104105
SectionModel(model: "Normal Users", items: $0.users)
105106
]
106107
}
107-
.catchError { (error) in
108-
showAlert(error.localizedDescription)
109-
return Observable.empty()
110-
}
111108
.bind(to: tableView.rx.items(dataSource: dataSource))
112109
.disposed(by: disposeBag)
113110

0 commit comments

Comments
 (0)