Class: Producer::Core::ErrorFormatter
- Inherits:
-
Object
- Object
- Producer::Core::ErrorFormatter
- Defined in:
- lib/producer/core/error_formatter.rb
Constant Summary collapse
- FILTERS =
[ /\/producer-\w+\/(?:bin|lib)\//, /\/net\/ssh\//, /\/net\/sftp\// ].freeze
Instance Method Summary collapse
- #debug? ⇒ Boolean
- #format(exception) ⇒ Object
-
#initialize(debug: false, force_cause: []) ⇒ ErrorFormatter
constructor
A new instance of ErrorFormatter.
Constructor Details
#initialize(debug: false, force_cause: []) ⇒ ErrorFormatter
Returns a new instance of ErrorFormatter.
10 11 12 13 |
# File 'lib/producer/core/error_formatter.rb', line 10 def initialize(debug: false, force_cause: []) @debug = debug @force_cause = force_cause end |
Instance Method Details
#debug? ⇒ Boolean
15 16 17 |
# File 'lib/producer/core/error_formatter.rb', line 15 def debug? !!@debug end |
#format(exception) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/producer/core/error_formatter.rb', line 19 def format(exception) lines = format_exception exception if debug? && exception.cause lines << '' lines << 'cause:' lines << format_exception(exception.cause, filter: false) end lines.join("\n") end |