Exception: Buildr::TestFramework::TestResult::Error

Inherits:
Exception
  • Object
show all
Defined in:
lib/buildr/java/test_result.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, backtrace) ⇒ Error

Returns a new instance of Error.



26
27
28
29
30
# File 'lib/buildr/java/test_result.rb', line 26

def initialize(message, backtrace)
  @message = message
  @backtrace = backtrace
  set_backtrace backtrace
end

Instance Attribute Details

#backtraceObject (readonly)

Returns the value of attribute backtrace.



25
26
27
# File 'lib/buildr/java/test_result.rb', line 25

def backtrace
  @backtrace
end

#messageObject (readonly)

Returns the value of attribute message.



25
26
27
# File 'lib/buildr/java/test_result.rb', line 25

def message
  @message
end

Class Method Details

.dump_yaml(file, e) ⇒ Object



32
33
34
35
# File 'lib/buildr/java/test_result.rb', line 32

def self.dump_yaml(file, e)
  FileUtils.mkdir_p File.dirname(file)
  File.open(file, 'w') { |f| f.puts(YAML.dump(Error.new(e.message, e.backtrace))) }
end

.guard(file) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/buildr/java/test_result.rb', line 37

def self.guard(file)
  begin
    yield
  rescue => e
    dump_yaml(file, e)
  end
end