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

added InvalidRequestTokenError error #253

Merged
merged 3 commits into from
Mar 9, 2022
Merged

added InvalidRequestTokenError error #253

merged 3 commits into from
Mar 9, 2022

Conversation

bartes
Copy link
Contributor

@bartes bartes commented Mar 9, 2022

No description provided.

@bartes bartes marked this pull request as ready for review March 9, 2022 02:56
@bartes bartes self-assigned this Mar 9, 2022
@bartes bartes requested review from dawlib and madejejej March 9, 2022 11:51
if parsed_body.is_a?(Hash) && parsed_body[:type] == INVALID_REQUEST_TOKEN
return Castle::InvalidRequestTokenError
end
rescue JSON::ParserError
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to assume our API can return an invalid JSON here? Perhaps we could catch JSON::ParserError in the call method instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also used for the legacy endpoints, I wanted to keep the functionality unchanged if that error type value is not present

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Legacy APIs respond with the same format for 422 errors

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about eg impersonation endpoints, I prefer to keep that somehow covered

end
end

Castle::InvalidParametersError
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great to add a proper error message to these exceptions. Or is this going to be a different PR? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 good point

@bartes bartes requested a review from madejejej March 9, 2022 13:03
@bartes bartes merged commit 9284360 into develop Mar 9, 2022
@bartes bartes deleted the invalid_token_error branch March 10, 2022 12:28
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.

2 participants