MCPcopy Create free account
hub / github.com/PRQL/prql / fmt

Method fmt

prqlc/prqlc/src/error_message.rs:43–64  ·  view source on GitHub ↗
(&self, f: &mut Formatter<'_>)

Source from the content-addressed store, hash-verified

41
42impl Display for ErrorMessage {
43 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
44 // https://github.com/zesterer/ariadne/issues/52
45 if let Some(display) = &self.display {
46 let message_without_trailing_spaces = display
47 .split('\n')
48 .map(str::trim_end)
49 .collect::<Vec<_>>()
50 .join("\n");
51 f.write_str(&message_without_trailing_spaces)?;
52 } else {
53 let code = (self.code.as_ref())
54 .map(|c| format!("[{c}] "))
55 .unwrap_or_default();
56
57 writeln!(f, "{}Error: {}", code, &self.reason)?;
58 for hint in &self.hints {
59 // TODO: consider alternative formatting for hints.
60 writeln!(f, "↳ Hint: {hint}")?;
61 }
62 }
63 Ok(())
64 }
65}
66
67impl Debug for ErrorMessage {

Callers

nothing calls this directly

Calls 2

mapMethod · 0.80
write_strMethod · 0.80

Tested by

no test coverage detected