Exception: Rubyists::Leopard::LeopardError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/leopard/errors.rb

Direct Known Subclasses

Error

Instance Method Summary collapse

Constructor Details

#initializeLeopardError

Returns a new instance of LeopardError.



6
7
8
9
# File 'lib/leopard/errors.rb', line 6

def initialize(...)
  super
  set_backtrace(caller)
end

Instance Method Details

#backtraceObject



11
12
13
14
15
16
17
18
19
# File 'lib/leopard/errors.rb', line 11

def backtrace
  # If the backtrace is nil, return an empty array
  orig = (super || [])[0..3]
  # If the backtrace is less than 4 lines, return it as is
  return orig if orig.size < 4

  # Otherwise, add a note indicating truncation
  orig + ['... (truncated by Leopard)']
end