ChemPal Documentation - v1.7.0
    Preparing search index...

    Module helpers/bugReport

    Bug reporting - Helpers

    Diagnostics

    A fully-assembled diagnostics snapshot, ready to render into a report.

    Functions

    truncate

    Truncates text to a character budget, appending a marker (and a note that the full detail is on the clipboard) when it has to cut.

    collectDiagnostics

    Collects a full diagnostics snapshot. When called with a specific error, its message and stack lead the report; otherwise the report is "manual" and the ring buffer of recent exceptions stands in for the stack.

    formatMetadata

    Formats the always-short environment block (fits any URL budget).

    formatLogs

    Formats the unbounded part — the primary stack, recent exceptions, and any extra payload. This is what gets truncated to fit a URL budget.

    formatDiagnostics

    Formats the complete diagnostics — metadata plus logs — for the review dialog and the clipboard.

    buildGithubUrl

    Builds a prefilled GitHub issue-form URL. Because a template is set, GitHub prefills by field id (version, diagnostics, logs) rather than body. The logs field is shrunk last so the whole URL stays within the configured character budget.

    buildGoogleFormUrl

    Builds a prefilled Google Form viewform URL. Field ids come from config.json (report.googleForm.entries); the logs value is truncated to the form-specific budget (Google Forms drops prefills on very long URLs).

    openTab

    Opens a URL in a new browser tab, using chrome.tabs.create inside the extension and falling back to window.open elsewhere.

    Interfaces

    ReportContext

    Optional caller-supplied context attached to a report.