1#[cfg(not(feature = "std"))]
4use alloc::string::String;
5
6#[derive(Debug, Clone)]
7pub struct BopError {
8 pub line: Option<u32>,
9 pub column: Option<u32>,
10 pub message: String,
11 pub friendly_hint: Option<String>,
12}
13
14impl core::fmt::Display for BopError {
15 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
16 if let Some(line) = self.line {
17 write!(f, "[line {}] {}", line, self.message)
18 } else {
19 write!(f, "{}", self.message)
20 }
21 }
22}
23
24#[cfg(feature = "std")]
25impl std::error::Error for BopError {}