Class: Flightdeck::ErrorSummary
- Inherits:
-
Object
- Object
- Flightdeck::ErrorSummary
- Defined in:
- app/models/flightdeck/error_summary.rb
Overview
A failed execution's error column is JSON that can run to many kilobytes
once a backtrace is in it. List views only ever read a bounded prefix of it,
which means the JSON is usually truncated mid-string — so parse when we can
and fall back to scanning for the two fields we need.
Constant Summary collapse
- UNKNOWN =
"UnknownError"
Instance Attribute Summary collapse
-
#exception_class ⇒ Object
readonly
Returns the value of attribute exception_class.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Class Method Summary collapse
Instance Method Summary collapse
- #group_key ⇒ Object
-
#initialize(raw) ⇒ ErrorSummary
constructor
A new instance of ErrorSummary.
- #present? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(raw) ⇒ ErrorSummary
Returns a new instance of ErrorSummary.
21 22 23 |
# File 'app/models/flightdeck/error_summary.rb', line 21 def initialize(raw) @exception_class, @message = extract(raw) end |
Instance Attribute Details
#exception_class ⇒ Object (readonly)
Returns the value of attribute exception_class.
11 12 13 |
# File 'app/models/flightdeck/error_summary.rb', line 11 def exception_class @exception_class end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
11 12 13 |
# File 'app/models/flightdeck/error_summary.rb', line 11 def @message end |
Class Method Details
.none ⇒ Object
17 18 19 |
# File 'app/models/flightdeck/error_summary.rb', line 17 def self.none new(nil) end |
.parse(raw) ⇒ Object
13 14 15 |
# File 'app/models/flightdeck/error_summary.rb', line 13 def self.parse(raw) new(raw) end |
Instance Method Details
#group_key ⇒ Object
29 30 31 |
# File 'app/models/flightdeck/error_summary.rb', line 29 def group_key exception_class.presence || UNKNOWN end |
#present? ⇒ Boolean
25 26 27 |
# File 'app/models/flightdeck/error_summary.rb', line 25 def present? exception_class.present? end |
#to_s ⇒ Object
33 34 35 36 37 |
# File 'app/models/flightdeck/error_summary.rb', line 33 def to_s return "" unless present? .present? ? "#{exception_class}: #{}" : exception_class end |