From 8bda4d593df8bf9aa22a5556b9f9200cd53de2f2 Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Mon, 17 Apr 2023 11:50:31 +1200 Subject: [PATCH] Remove try catch from set_list pagination All this does is obscure errors. I want it to break when things go wrong and show me why in the logs. --- lib/set_list.dart | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/lib/set_list.dart b/lib/set_list.dart index 5c4d32f..7f3cd36 100644 --- a/lib/set_list.dart +++ b/lib/set_list.dart @@ -35,22 +35,18 @@ class _SetList extends State { } Future fetch(int pageKey) async { - try { - final gymSets = await (db.select(db.gymSets) - ..where((gymSet) => gymSet.name.contains(widget.search)) - ..limit(10, offset: pageKey * 10)) - .get(); + final gymSets = await (db.select(db.gymSets) + ..where((gymSet) => gymSet.name.contains(widget.search)) + ..limit(10, offset: pageKey * 10)) + .get(); - final isLastPage = gymSets.length < 10; + final isLastPage = gymSets.length < 10; - if (isLastPage) { - pagingController.appendLastPage(gymSets); - } else { - final nextPageKey = pageKey + 1; - pagingController.appendPage(gymSets, nextPageKey); - } - } catch (error) { - pagingController.error = error; + if (isLastPage) { + pagingController.appendLastPage(gymSets); + } else { + final nextPageKey = pageKey + 1; + pagingController.appendPage(gymSets, nextPageKey); } }