Class: Kcaco::WrappedException
- Inherits:
-
Object
- Object
- Kcaco::WrappedException
- Defined in:
- lib/kcaco/wrapped_exception.rb
Instance Attribute Summary collapse
-
#exception ⇒ Object
Returns the value of attribute exception.
-
#payload ⇒ Object
Returns the value of attribute payload.
Instance Method Summary collapse
- #backtrace ⇒ Object
- #extract_filename_and_line_no(line) ⇒ Object
- #filename ⇒ Object
- #filename_and_line_no ⇒ Object
-
#initialize(exception) ⇒ WrappedException
constructor
A new instance of WrappedException.
- #line_no ⇒ Object
- #message ⇒ Object
- #pretty ⇒ Object
- #title ⇒ Object
- #to_yaml ⇒ Object
- #type ⇒ Object
- #uuid ⇒ Object
Constructor Details
#initialize(exception) ⇒ WrappedException
Returns a new instance of WrappedException.
9 10 11 |
# File 'lib/kcaco/wrapped_exception.rb', line 9 def initialize(exception) self.exception = exception end |
Instance Attribute Details
#exception ⇒ Object
Returns the value of attribute exception.
7 8 9 |
# File 'lib/kcaco/wrapped_exception.rb', line 7 def exception @exception end |
#payload ⇒ Object
Returns the value of attribute payload.
7 8 9 |
# File 'lib/kcaco/wrapped_exception.rb', line 7 def payload @payload end |
Instance Method Details
#backtrace ⇒ Object
22 23 24 |
# File 'lib/kcaco/wrapped_exception.rb', line 22 def backtrace exception.backtrace end |
#extract_filename_and_line_no(line) ⇒ Object
30 31 32 33 34 |
# File 'lib/kcaco/wrapped_exception.rb', line 30 def extract_filename_and_line_no(line) if (m = line.match(/(.+):(\d+):/)) [File.basename(m[1]), m[2].to_i] end end |
#filename ⇒ Object
41 42 43 |
# File 'lib/kcaco/wrapped_exception.rb', line 41 def filename filename_and_line_no.first end |
#filename_and_line_no ⇒ Object
36 37 38 39 |
# File 'lib/kcaco/wrapped_exception.rb', line 36 def filename_and_line_no @filename_and_line_no ||= extract_filename_and_line_no(backtrace.first) end |
#line_no ⇒ Object
45 46 47 |
# File 'lib/kcaco/wrapped_exception.rb', line 45 def line_no filename_and_line_no.last end |
#message ⇒ Object
18 19 20 |
# File 'lib/kcaco/wrapped_exception.rb', line 18 def exception. end |
#pretty ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/kcaco/wrapped_exception.rb', line 53 def pretty [ uuid, title, "[%s L%i]" % [filename, line_no], ].join(" ") end |
#title ⇒ Object
49 50 51 |
# File 'lib/kcaco/wrapped_exception.rb', line 49 def title [type, ].join(": ") end |
#to_yaml ⇒ Object
26 27 28 |
# File 'lib/kcaco/wrapped_exception.rb', line 26 def to_yaml exception.to_yaml end |
#type ⇒ Object
14 15 16 |
# File 'lib/kcaco/wrapped_exception.rb', line 14 def type exception.class.name end |
#uuid ⇒ Object
61 62 63 |
# File 'lib/kcaco/wrapped_exception.rb', line 61 def uuid @uuid ||= Guid.new.to_s end |