pub fn format_adam_error(
e: &Error,
diagnostics: &SheetDiagnostics,
source: &str,
file_name: &str,
renderer: &Renderer,
) -> StringExpand description
Formats an Error as a rustc-style diagnostic when possible.
Resolves native sites through diagnostics, groups labels by owning source identity
and renders definition files followed by invocation context. Inner CEL spans use
their definition text, never the caller’s text. Source-free labels remain visible.
file_name overrides only the anonymous AdamParser input’s display name.
For legacy anonymous errors with no native site, source supplies the CEL text.
- Complexity: Provenance resolution plus O(n + l) source bytes and labels rendered.
§Examples
let parsed = adam_lang::ParsedSheet::new();
let text = adam_web_ui::format_adam_error(&adam_rs::Error::InvalidId,
&parsed.diagnostics(), "", "input.adm2", &adam_web_ui::Renderer::plain());
assert_eq!(text, "invalid cell or relationship id");