Exception: HealthBit::CheckError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/health_bit/check_error.rb

Constant Summary collapse

FORMAT_FULL =
:full
FORMAT_SHORT =
nil

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, exception: nil) ⇒ CheckError

Returns a new instance of CheckError.



10
11
12
13
# File 'lib/health_bit/check_error.rb', line 10

def initialize(name, exception: nil)
  @name = name
  @exception = exception
end

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



8
9
10
# File 'lib/health_bit/check_error.rb', line 8

def exception
  @exception
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/health_bit/check_error.rb', line 8

def name
  @name
end

Instance Method Details

#to_s(format = nil) ⇒ String

Returns:

  • (String)


16
17
18
19
20
21
22
23
24
25
26
# File 'lib/health_bit/check_error.rb', line 16

def to_s(format = nil)
  io = StringIO.new
  io.puts "Check <#{name}> failed"

  case format
  when FORMAT_FULL
    describe_exception(io)
  end

  io.string.chomp
end