plotnik_lib/emit/
error.rs1use plotnik_core::Symbol;
4
5#[derive(Clone, Debug)]
7pub enum EmitError {
8 InvalidQuery,
10 TooManyStrings(usize),
12 TooManyTypes(usize),
14 TooManyTypeMembers(usize),
16 TooManyEntrypoints(usize),
18 TooManyTransitions(usize),
20 StringNotFound(Symbol),
22 Compile(crate::compile::CompileError),
24}
25
26impl std::fmt::Display for EmitError {
27 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28 match self {
29 Self::InvalidQuery => write!(f, "query has validation errors"),
30 Self::TooManyStrings(n) => write!(f, "too many strings: {n} (max 65534)"),
31 Self::TooManyTypes(n) => write!(f, "too many types: {n} (max 65533)"),
32 Self::TooManyTypeMembers(n) => write!(f, "too many type members: {n} (max 65535)"),
33 Self::TooManyEntrypoints(n) => write!(f, "too many entrypoints: {n} (max 65535)"),
34 Self::TooManyTransitions(n) => write!(f, "too many transitions: {n} (max 65535)"),
35 Self::StringNotFound(sym) => write!(f, "string not found for symbol: {sym:?}"),
36 Self::Compile(e) => write!(f, "compilation error: {e}"),
37 }
38 }
39}
40
41impl std::error::Error for EmitError {}