0
如何在Ruby中處理Mogo副本集Mongo :: ConnectionFailure異常?Ruby:如何處理Mongo副本集Mongo :: ConnectionFailure異常?
嘗試:
begin
$mongo = Mongo::MongoReplicaSetClient.new(['seed1:27017', 'seed2:27017', 'seed3:27017'], :read => :primary, :rs_name => 'rs0', :connect_timeout => 30, :op_timeout => 30)
mongo = $mongo.db('db_name')
rescue Exception => ex
puts ex.message
rescue Mongo::ConnectionFailure => ex
puts ex.message
rescue RuntimeError => ex
puts ex.message
rescue => ex
puts ex.message
end
沒有人能處理救援塊的異常消息