Class: RailsErrorDashboard::Services::IssueBodyFormatter
- Inherits:
-
Object
- Object
- RailsErrorDashboard::Services::IssueBodyFormatter
- Defined in:
- lib/rails_error_dashboard/services/issue_body_formatter.rb
Overview
Pure algorithm: Format error details as markdown for issue tracker body.
Tailored for issue context — shorter than MarkdownErrorFormatter, includes a link back to the dashboard, and omits system health (not useful in a GitHub issue body).
Constant Summary collapse
- MAX_BACKTRACE_LINES =
20
Class Method Summary collapse
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(error, dashboard_url) ⇒ IssueBodyFormatter
constructor
A new instance of IssueBodyFormatter.
Constructor Details
#initialize(error, dashboard_url) ⇒ IssueBodyFormatter
Returns a new instance of IssueBodyFormatter.
23 24 25 26 |
# File 'lib/rails_error_dashboard/services/issue_body_formatter.rb', line 23 def initialize(error, dashboard_url) @error = error @dashboard_url = dashboard_url end |
Class Method Details
.call(error, dashboard_url: nil) ⇒ Object
17 18 19 20 21 |
# File 'lib/rails_error_dashboard/services/issue_body_formatter.rb', line 17 def self.call(error, dashboard_url: nil) new(error, dashboard_url).generate rescue => e "Error details could not be formatted: #{e.}" end |
Instance Method Details
#generate ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rails_error_dashboard/services/issue_body_formatter.rb', line 28 def generate sections = [] sections << heading_section sections << backtrace_section sections << cause_chain_section sections << request_context_section sections << environment_section sections << sections << dashboard_link_section sections.compact.join("\n\n") rescue => e "Error details could not be formatted." end |