fix: dev: catch IndexError

This commit is contained in:
rachmadaniHaryono 2018-03-29 04:40:00 +08:00
parent b3d678fc7c
commit 93bb1f108c

View File

@ -85,7 +85,12 @@ def bookmarks():
current_app.logger.debug('per page:{}'.format(per_page)) current_app.logger.debug('per page:{}'.format(per_page))
pagination_total = len(result['bookmarks']) pagination_total = len(result['bookmarks'])
bms = list(chunks(result['bookmarks'], per_page)) bms = list(chunks(result['bookmarks'], per_page))
try:
result['bookmarks'] = bms[page-1] 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( pagination = Pagination(
page=page, total=pagination_total, per_page=per_page, page=page, total=pagination_total, per_page=per_page,
search=False, record_name='bookmarks', bs_version=3 search=False, record_name='bookmarks', bs_version=3