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

Exception messages are ruby hash string literals #63

Closed
chazu opened this issue Apr 28, 2016 · 0 comments
Closed

Exception messages are ruby hash string literals #63

chazu opened this issue Apr 28, 2016 · 0 comments

Comments

@chazu
Copy link

chazu commented Apr 28, 2016

when an API error results in a BadRequest exception being thrown, client code using the gem only has access to the exception message as a ruby hash literal - meaning that eval must be called to change it into a format from which the actual message or error code can be extracted.

While regexp matching could be used as a slightly-more-secure workaround, in cases where either exception error messages could be forwarded to end users or other logic is in place which examines the response body when an exception is thrown, this makes it clunky to work with exception data. If the request body were JSON-encoded before being set to the message of an exception, client code could at least parse the exception's message into a hash when thrown.

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

No branches or pull requests

2 participants