The problem is in relation to the radis-rb
gem.
The exception is not caught by my rescue block and my app goes down.
My code:
begin
redis = Redis.new
puts "WTF?"
rescue Exception
puts "Exception"
end
If redis
is down, the message WTF? is exposed.
It happens with or without the Exception statement.
Why is the exception not raised to my rescue block?
I have solved the problem myself (with help from the community and comments).
The exception occurred in IRB only.
The reason of one is IRB's inspect
call when IRB try to print result of Redis.new
.
In the script (not IRB), the exception doesn't occur because Redis.new
does not raise an exception if the Redis
service is down.
This question helped to solve my problem.