Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

non-obvious error when passing invalid 'previous' or 'next' tokens #118

Open
bradvogel opened this issue Mar 12, 2020 · 1 comment
Open
Labels

Comments

@bradvogel
Copy link
Contributor

When passing an incorrect value such as 'next=NOT_REAL_TOKEN', this library will throw the exception Unexpected token } in JSON at position 0. It would be better if it threw a more obvious error such as "Invalid valid for 'next'"

@bradvogel bradvogel added the bug label Mar 30, 2020
@mvibraim
Copy link

SyntaxError: Unexpected end of JSON input
  at JSON.parse (<anonymous>)
  at Object.module.exports.parse (/usr/src/app/node_modules/mongodb-extended-json/lib/index.js:39:21)
  at Object.module.exports.decode (/usr/src/app/node_modules/mongo-cursor-pagination/src/utils/bsonUrlEncoding.js:14:16)
  at sanitizeParams (/usr/src/app/node_modules/mongo-cursor-pagination/src/utils/sanitizeParams.js:8:50)
  at module.exports (/usr/src/app/node_modules/mongo-cursor-pagination/src/find.js:33:11)
  at Object.findWithReq (/usr/src/app/node_modules/mongo-cursor-pagination/src/findWithReq.js:27:10)

JSON input: {"$oid":"5ea922dce5bb260409f14010"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants