check out ouf bounds
This commit is contained in:
parent
fcfd649042
commit
4122f6e5ae
1 changed files with 6 additions and 0 deletions
|
|
@ -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}
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue