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

Add exception for handling invalid request token #127

Merged
merged 2 commits into from
Mar 1, 2022

Conversation

wallin
Copy link
Member

@wallin wallin commented Mar 1, 2022

Introduce a separate exception InvalidRequestTokenError for handling missing or invalid request token. Per default, Castle recommends rejecting these requests, as opposed to other 422 status errors, which are indicators of integration errors.

Example usage:

try {
  castle.risk(...)
} catch (e) {
  if (e instanceof InvalidRequestTokenError) {
     // Block request
  } else if (e instanceof InvalidParametersError) {
     // Data missing or invalid. Needs to be fixed
  }
}

@wallin wallin self-assigned this Mar 1, 2022
@wallin wallin merged commit 52a7cea into develop Mar 1, 2022
wallin added a commit that referenced this pull request Mar 2, 2022
* Update README.md (#124)

* Update README.md

* Correct URL to docs

* Update README.md (#126)

* corrected readme timeout (#125)

* Add exception for handling invalid request token (#127)

Co-authored-by: Bartosz <bartesrlz@gmail.com>
@bartes bartes deleted the exception-for-invalid-request-token branch March 22, 2022 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants