Sha256: d5a282f87bce48a3471e5690f4237d6ac252fc87b14559c66e192263efa3e04c

Contents?: true

Size: 603 Bytes

Versions: 8

Compression:

Stored size: 603 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

8 entries across 8 versions & 1 rubygems

Version Path
twilio-ruby-5.2.2 lib/twilio-ruby/framework/error.rb
twilio-ruby-5.2.1 lib/twilio-ruby/framework/error.rb
twilio-ruby-5.2.0 lib/twilio-ruby/framework/error.rb
twilio-ruby-5.1.2 lib/twilio-ruby/framework/error.rb
twilio-ruby-5.1.1 lib/twilio-ruby/framework/error.rb
twilio-ruby-5.1.0 lib/twilio-ruby/framework/error.rb
twilio-ruby-5.0.0.alpha1 lib/twilio-ruby/framework/error.rb
twilio-ruby-5.0.0 lib/twilio-ruby/framework/error.rb