Class: RailsErrorDashboard::Services::MarkdownErrorFormatter
- Inherits:
-
Object
- Object
- RailsErrorDashboard::Services::MarkdownErrorFormatter
- Defined in:
- lib/rails_error_dashboard/services/markdown_error_formatter.rb
Overview
Pure algorithm: Format error details as clean Markdown for LLM debugging
Reads data already stored in ErrorLog — zero runtime cost. Called at display time only. Sections are conditional — only included when data is present.
Constant Summary collapse
- MAX_BACKTRACE_LINES =
15- MAX_BREADCRUMBS =
10- MAX_VARIABLES =
10- MAX_LLM_CALL_ROWS =
10
Class Method Summary collapse
-
.call(error, related_errors: []) ⇒ String
Markdown-formatted error details, or “” on failure.
Instance Method Summary collapse
- #generate ⇒ String
-
#initialize(error, related_errors) ⇒ MarkdownErrorFormatter
constructor
A new instance of MarkdownErrorFormatter.
Constructor Details
#initialize(error, related_errors) ⇒ MarkdownErrorFormatter
Returns a new instance of MarkdownErrorFormatter.
29 30 31 32 |
# File 'lib/rails_error_dashboard/services/markdown_error_formatter.rb', line 29 def initialize(error, ) @error = error @related_errors = end |
Class Method Details
.call(error, related_errors: []) ⇒ String
Returns Markdown-formatted error details, or “” on failure.
23 24 25 26 27 |
# File 'lib/rails_error_dashboard/services/markdown_error_formatter.rb', line 23 def self.call(error, related_errors: []) new(error, ).generate rescue => e "" end |
Instance Method Details
#generate ⇒ String
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/rails_error_dashboard/services/markdown_error_formatter.rb', line 35 def generate sections = [] sections << heading_section sections << backtrace_section sections << source_code_section sections << cause_chain_section sections << local_variables_section sections << instance_variables_section sections << request_context_section sections << llm_calls_section sections << sections << environment_section sections << system_health_section sections << sections << sections.compact.join("\n\n") rescue => e "" end |