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

Bug: Pagination limit error is a bit too vague #35

Open
tracy-codes opened this issue Feb 21, 2023 · 1 comment
Open

Bug: Pagination limit error is a bit too vague #35

tracy-codes opened this issue Feb 21, 2023 · 1 comment

Comments

@tracy-codes
Copy link

Currently, if you set limit to > 1000 (hardcoded for now), you will get back a RPC error message saying Pagination Error. Only one pagination parameter supported per query.. For a better user experience, this error message should be specific for the pagination limit.

@staccDOTsol
Copy link

Yes, I agree that the error message you are getting is not very helpful. One way to improve the user experience would be to add a custom error message that specifically mentions the pagination limit.

You can do this by catching the error that is thrown when the limit is exceeded and then throwing a new error with a more specific message. Here's an example of how you can do this in JavaScript:

try {
  // make API call with pagination limit > 1000
} catch (error) {
  if (error.message.includes('Pagination Error') && error.message.includes('limit')) {
    throw new Error('Pagination limit exceeded. Please set limit to 1000 or less.');
  } else {
    // handle other errors
  }
}

This code checks if the error message contains both the words "Pagination Error" and "limit". If it does, it throws a new error with a more specific message. Otherwise, it handles the error in some other way.

You can customize the error message to suit your needs.

muhitrhn pushed a commit to muhitrhn/digital-asset-rpc-infrastructure that referenced this issue Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants