Sha256: ee4429011aad5932031ddd968f76cd766da67474e448bc8bcfa15f3e36f53790

Contents?: true

Size: 454 Bytes

Versions: 14

Compression:

Stored size: 454 Bytes

Contents

# encoding: utf-8

module Punchblock
  module Translator
    class Asterisk
      module AMIErrorConverter
        def self.convert(result = ->(e) { raise ChannelGoneError, e.message } )
          yield
        rescue RubyAMI::Error => e
          case e.message
          when 'No such channel', /Channel (\S+) does not exist./
            result.call e if result
          else
            raise e
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
punchblock-2.7.5 lib/punchblock/translator/asterisk/ami_error_converter.rb
punchblock-2.7.3 lib/punchblock/translator/asterisk/ami_error_converter.rb
punchblock-2.7.2 lib/punchblock/translator/asterisk/ami_error_converter.rb
punchblock-2.7.1 lib/punchblock/translator/asterisk/ami_error_converter.rb
punchblock-2.7.0 lib/punchblock/translator/asterisk/ami_error_converter.rb
punchblock-2.6.0 lib/punchblock/translator/asterisk/ami_error_converter.rb
punchblock-2.5.3 lib/punchblock/translator/asterisk/ami_error_converter.rb
punchblock-2.5.2 lib/punchblock/translator/asterisk/ami_error_converter.rb
punchblock-2.5.1 lib/punchblock/translator/asterisk/ami_error_converter.rb
punchblock-2.5.0 lib/punchblock/translator/asterisk/ami_error_converter.rb
punchblock-2.4.2 lib/punchblock/translator/asterisk/ami_error_converter.rb
punchblock-2.4.0 lib/punchblock/translator/asterisk/ami_error_converter.rb
punchblock-2.3.1 lib/punchblock/translator/asterisk/ami_error_converter.rb
punchblock-2.3.0 lib/punchblock/translator/asterisk/ami_error_converter.rb