Sha256: 1ee9d8a509a5e076b46692b9e1161332dab3299b4ca3ed7c4accf423d60bc029

Contents?: true

Size: 602 Bytes

Versions: 20

Compression:

Stored size: 602 Bytes

Contents

require 'pycall/error'

module PyCall
  class PyError < Error
    def initialize(type, value, traceback)
      @type = type
      @value = value
      @traceback = traceback
      super("Exception occurred in Python")
    end

    attr_reader :type, :value, :traceback

    def to_s
      "#{type}: #{value}".tap do |msg|
        if (strs = format_traceback)
          msg << "\n"
          strs.each {|s| msg << s }
        end
      end
    end

    private

    def format_traceback
      return nil if traceback.nil?
      ::PyCall.import_module('traceback').format_tb(traceback)
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
pycall-1.5.1 lib/pycall/pyerror.rb
pycall-1.5.0 lib/pycall/pyerror.rb
pycall-1.4.2 lib/pycall/pyerror.rb
pycall-1.4.1 lib/pycall/pyerror.rb
pycall-1.4.0 lib/pycall/pyerror.rb
pycall-1.3.1 lib/pycall/pyerror.rb
pycall-1.3.0 lib/pycall/pyerror.rb
pycall-1.3.0.dev lib/pycall/pyerror.rb
pycall-1.2.1 lib/pycall/pyerror.rb
pycall-1.2.0 lib/pycall/pyerror.rb
pycall-1.2.0.beta1 lib/pycall/pyerror.rb
pycall-1.1.0.rc1 lib/pycall/pyerror.rb
pycall-1.0.3 lib/pycall/pyerror.rb
pycall-1.0.2-x86-mingw32 lib/pycall/pyerror.rb
pycall-1.0.2-x64-mingw32 lib/pycall/pyerror.rb
pycall-1.0.2 lib/pycall/pyerror.rb
pycall-1.0.1-x86-mingw32 lib/pycall/pyerror.rb
pycall-1.0.1-x64-mingw32 lib/pycall/pyerror.rb
pycall-1.0.1 lib/pycall/pyerror.rb
pycall-1.0.0 lib/pycall/pyerror.rb