Sha256: 9bcacb15fd97a995bbdc562535b413768d8110082c1cbd8aa511ee7f2d323378

Contents?: true

Size: 454 Bytes

Versions: 3

Compression:

Stored size: 454 Bytes

Contents

# encoding: utf-8

module Adhearsion
  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

3 entries across 3 versions & 1 rubygems

Version Path
adhearsion-3.0.0.rc1 lib/adhearsion/translator/asterisk/ami_error_converter.rb
adhearsion-3.0.0.beta2 lib/adhearsion/translator/asterisk/ami_error_converter.rb
adhearsion-3.0.0.beta1 lib/adhearsion/translator/asterisk/ami_error_converter.rb