Skip to content

added InvalidRequestTokenError error#253

Merged
bartes merged 3 commits intodevelopfrom
invalid_token_error
Mar 9, 2022
Merged

added InvalidRequestTokenError error#253
bartes merged 3 commits intodevelopfrom
invalid_token_error

Conversation

@bartes
Copy link
Contributor

@bartes bartes commented Mar 9, 2022

No description provided.

@bartes bartes force-pushed the invalid_token_error branch from 11e8fd9 to 4deebad Compare March 9, 2022 02:54
@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