Module: Eussiror::IssueFormatting

Defined in:
lib/eussiror/issue_formatting.rb

Overview

Builds GitHub issue bodies and occurrence comments. Accepts either a Rack env hash or a plain Rails.error context hash.

Constant Summary collapse

USER_ID_KEY =
"eussiror.user_id"
USER_LABEL_KEY =
"eussiror.user_label"

Class Method Summary collapse

Class Method Details

.issue_body(exception, context, fingerprint, config, max_backtrace_lines, source_tag: "error") ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/eussiror/issue_formatting.rb', line 11

def issue_body(exception, context, fingerprint, config, max_backtrace_lines, source_tag: "error")
  normalized = ContextExtractor.normalize(context)
  <<~BODY
    #{error_details_section(exception)}
    #{context_section(config, source_tag)}
    #{user_section(normalized, config)}
    #{request_section(normalized, config)}
    ## Backtrace

    ```
    #{format_backtrace(exception, max_backtrace_lines)}
    ```

    <!-- #{GithubClient::FINGERPRINT_MARKER}:#{fingerprint} -->
  BODY
end

.occurrence_comment(context, config) ⇒ Object



28
29
30
31
# File 'lib/eussiror/issue_formatting.rb', line 28

def occurrence_comment(context, config)
  normalized = ContextExtractor.normalize(context)
  occurrence_lines(normalized, config).join("\n\n")
end