-
Notifications
You must be signed in to change notification settings - Fork 374
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
'DecodeError'will replace 'ExpiredSignature' #260
Comments
Hey @ctc1991, thanks for reporting. Can you provide sample code to reproduce this issue, please? |
Hi there @excpt and @ctc1991. I similarly encountered this, and I believe this behavior is attributable to So what this means is that if the code rescues Run this example: DecodeError = Class.new(StandardError)
ExpiredSignature = Class.new(DecodeError)
begin
raise ExpiredSignature.new
rescue DecodeError => exception
puts "#{exception.class} was raised, rescued in DecodeError"
rescue ExpiredSignature => exception
puts "#{exception.class} was raised, rescued in ExpiredSignature"
end This code outputs:
Now, reverse the order of those rescue blocks, and the result becomes:
Which is what I had originally intended when I laid out my first rescue chain. This behavior can be avoided by making sure the code rescues By the way, @excpt if you think this is worth looking into, I'd be happy to help on making a change. We could either replace
Let me know! Thanks. |
if you catch DecodeError, you will not get ExpiredSignature.
The text was updated successfully, but these errors were encountered: