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
inspectcall when IRB try to print result ofRedis.new.In the script (not IRB), the exception doesn’t occur because
Redis.newdoes not raise an exception if theRedisservice is down.This question helped to solve my problem.