Sha256: 624be6505a1c3f6e9057161db4c79db856cc92fbdde7e6287718953e40cb6b8f

Contents?: true

Size: 639 Bytes

Versions: 64

Compression:

Stored size: 639 Bytes

Contents

#!/usr/bin/env ruby
# encoding: utf-8

require "bundler"
Bundler.setup

$:.unshift(File.expand_path("../../../lib", __FILE__))

require 'amqp'


puts "=> TCP connection failure handling with a rescue statement"
puts

connection_settings = {
  :port     => 9689,
  :vhost    => "/amq_client_testbed",
  :user     => "amq_client_gem",
  :password => "amq_client_gem_password",
  :timeout        => 0.3
}

begin
  AMQP.start(connection_settings) do |connection, open_ok|
    raise "This should not be reachable"
  end
rescue AMQP::TCPConnectionFailed => e
  puts "Caught AMQP::TCPConnectionFailed => TCP connection failed, as expected."
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
amqp-1.8.0 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
amqp-1.7.0 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
amqp-1.6.0 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
amqp-1.5.3 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
amqp-1.5.2 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
amqp-1.5.1 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
amqp-1.5.0 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
amqp-1.4.2 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
amqp-1.4.1 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
amqp-1.4.0 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
amqp-1.3.0 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
amqp-1.2.1 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
amqp-1.2.0 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
amqp-1.1.8 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
amqp-1.1.7 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
amqp-1.1.6 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
amqp-1.1.5 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
amqp-1.1.4 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
amqp-1.1.3 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb
amqp-1.0.4 examples/error_handling/tcp_connection_failure_handling_with_a_rescue_block.rb