check out ouf bounds

This commit is contained in:
Daniel Lugo 2020-06-25 12:33:54 -04:00
parent fcfd649042
commit 4122f6e5ae

View file

@ -23,6 +23,8 @@ const getWallTotalPages = async () => {
/**
* @param {number} page
* @throws {TypeError}
* @throws {RangeError}
* @returns {Promise<Common.SchemaTypes.WallPage>}
*/
const getWallPage = async page => {
@ -37,6 +39,10 @@ const getWallPage = async page => {
const actualPageIdx = page < 0 ? totalPages + (page + 1) : page - 1
if (actualPageIdx > totalPages - 1) {
throw new RangeError(`Requested a page out of bounds`)
}
/**
* @type {Common.SchemaTypes.WallPage}
*/