Exception: Cascading::CascadingException

Inherits:
StandardError
  • Object
show all
Defined in:
lib/cascading/cascading_exception.rb

Overview

NativeException wrapper that prints the full nested stack trace of the Java exception and all of its causes wrapped by the NativeException. NativeException by default reveals only the first cause, which is insufficient for tracing cascading.jruby errors into JRuby code or revealing underlying Janino expression problems.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(native_exception, message) ⇒ CascadingException

Returns a new instance of CascadingException.



10
11
12
13
14
15
# File 'lib/cascading/cascading_exception.rb', line 10

def initialize(native_exception, message)
  @ne = native_exception
  trace, @depth = trace_causes(@ne, 1)
  summary, _ = trace_causes(@ne, 1, true)
  super("#{message}\n#{trace}\nException summary for: #{message}\n#{summary}")
end

Instance Attribute Details

#depthObject

Returns the value of attribute depth.



8
9
10
# File 'lib/cascading/cascading_exception.rb', line 8

def depth
  @depth
end

#neObject

Returns the value of attribute ne.



8
9
10
# File 'lib/cascading/cascading_exception.rb', line 8

def ne
  @ne
end

Instance Method Details

#cause(depth = @depth) ⇒ Object

Fetch cause at depth. If depth is not provided, root cause is returned.



18
19
20
21
22
23
24
25
# File 'lib/cascading/cascading_exception.rb', line 18

def cause(depth = @depth)
  if depth > @depth
    warn "WARNING: Depth (#{depth}) greater than depth of cause stack (#{@depth}) requested"
    nil
  else
    fetch_cause(@ne, depth)
  end
end