Exception: Reports::Generator::GeneratorError
- Inherits:
-
StandardError
- Object
- StandardError
- Reports::Generator::GeneratorError
- Defined in:
- app/commands/reports/generator.rb
Constant Summary collapse
- ERROR_MSG =
"%{error_type} ERROR (%{option_type} - %{option_name})"- MISSING_HAS_REPORTS_MSG =
"Unable to generate report options for %{class_name}: missing has_reports"
Class Method Summary collapse
- .create_backtrace_string(base_error: nil) ⇒ Object
- .create_error_message(msg: "", base_error: nil) ⇒ Object
Instance Method Summary collapse
-
#initialize(full_error_list: nil) ⇒ GeneratorError
constructor
Allows for accumulating errors.
Constructor Details
#initialize(full_error_list: nil) ⇒ GeneratorError
Allows for accumulating errors.
11 12 13 14 |
# File 'app/commands/reports/generator.rb', line 11 def initialize(full_error_list: nil) = full_error_list&.reject(&:blank?)&.join("\n") super() end |
Class Method Details
.create_backtrace_string(base_error: nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/commands/reports/generator.rb', line 16 def self.create_backtrace_string(base_error: nil) if base_error [ "-" * 20, base_error., *base_error.backtrace.map { |line| "> #{ line }" } ].join("\n") else nil end end |
.create_error_message(msg: "", base_error: nil) ⇒ Object
28 29 30 31 32 33 |
# File 'app/commands/reports/generator.rb', line 28 def self.(msg: "", base_error: nil) [ msg, create_backtrace_string(base_error: base_error) ].reject(&:blank?).join("\n") end |