-
Notifications
You must be signed in to change notification settings - Fork 22
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
Decrypt - Malformed URI should throw an error and abort #4
Comments
This one might be an error of the URI module itself: http://elixir-lang.org/docs/stable/elixir/URI.html#parse/1
|
You can catch the exception like this, then return a sensible error:
|
In fact, that try rescue block will catch the other argument error I raised an issue about as well. Just need to return the correct msg. |
I think I should not output the original error message when an internal procedure fails, such as this case. That is just an escaping/unescaping mechanism that Cipher uses internally. The crypted string is not meant to be an actual URL, so it would be meaningless to see an error message like "Malformed URI" at this stage. I fixed this by differenciating and documenting (hopefully) meaningful errors at the 2 stages of decrypting. So you would get
Many thanks! |
I also added some of that to the README on master. |
Just released 1.0.2 including this! |
When I encrypt some data, manually change it slightly and then attempt to decrypt that, Cipher breaks on an error:
The text was updated successfully, but these errors were encountered: