Exception: PyCall::PyError

Inherits:
Error
  • Object
show all
Defined in:
lib/pycall/pyerror.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, value, traceback) ⇒ PyError

Returns a new instance of PyError.



5
6
7
8
9
10
# File 'lib/pycall/pyerror.rb', line 5

def initialize(type, value, traceback)
  @type = type
  @value = value
  @traceback = traceback
  super("Exception occurred in Python")
end

Instance Attribute Details

#tracebackObject (readonly)

Returns the value of attribute traceback.



12
13
14
# File 'lib/pycall/pyerror.rb', line 12

def traceback
  @traceback
end

#typeObject (readonly)

Returns the value of attribute type.



12
13
14
# File 'lib/pycall/pyerror.rb', line 12

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



12
13
14
# File 'lib/pycall/pyerror.rb', line 12

def value
  @value
end

Instance Method Details

#to_sObject



14
15
16
17
18
19
20
21
# File 'lib/pycall/pyerror.rb', line 14

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