From 93bb1f108ca6e72b0b76ce78ff96928ff886df54 Mon Sep 17 00:00:00 2001 From: rachmadaniHaryono Date: Thu, 29 Mar 2018 04:40:00 +0800 Subject: [PATCH] fix: dev: catch IndexError --- bukuserver/server.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bukuserver/server.py b/bukuserver/server.py index 2484638..5331409 100644 --- a/bukuserver/server.py +++ b/bukuserver/server.py @@ -85,7 +85,12 @@ def bookmarks(): current_app.logger.debug('per page:{}'.format(per_page)) pagination_total = len(result['bookmarks']) bms = list(chunks(result['bookmarks'], per_page)) - result['bookmarks'] = bms[page-1] + try: + result['bookmarks'] = bms[page-1] + except IndexError as err: + current_app.logger.debug('{}:{}, result bookmarks:{}, page:{}'.format( + type(err), err, len(result['bookmarks']), page + )) pagination = Pagination( page=page, total=pagination_total, per_page=per_page, search=False, record_name='bookmarks', bs_version=3