Sha256: 5248ffd6ee8fbbf095545f051c68423ee27d2f4bf0eac31fce9292cd78414a33

Contents?: true

Size: 604 Bytes

Versions: 7

Compression:

Stored size: 604 Bytes

Contents

module Twilio
  module REST
    class TwilioError < StandardError
      attr_reader :message, :body

      def initialize(message, body = nil)
        @message = message
        @body = body
      end

      def to_s
        "#{@message}: #{@body || 'no body'}"
      end
    end

    class RestError < TwilioError
      attr_reader :message, :code, :status_code

      def initialize(message, code, status_code)
        @message = message
        @code = code
        @status_code = status_code
      end

      def to_s
        "[HTTP #{status_code}] #{code} : #{message}"
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
twilio-ruby-5.0.0.rc26 lib/twilio-ruby/framework/error.rb
twilio-ruby-5.0.0.rc25 lib/twilio-ruby/framework/error.rb
twilio-ruby-5.0.0.rc24 lib/twilio-ruby/framework/error.rb
twilio-ruby-5.0.0.rc23 lib/twilio-ruby/framework/error.rb
twilio-ruby-5.0.0.rc22 lib/twilio-ruby/framework/error.rb
twilio-ruby-5.0.0.rc21 lib/twilio-ruby/framework/error.rb
twilio-ruby-5.0.0.rc20 lib/twilio-ruby/framework/error.rb