microcad_lang/resolve/
resolve_error.rs1use thiserror::Error;
7
8use crate::{parse::ParseError, src_ref::*, syntax::*};
9
10#[derive(Debug, Error)]
12pub enum ResolveError {
13 #[error("Not implemented: {0}")]
15 Todo(String),
16
17 #[error("Parse Error: {0}")]
19 ParseError(#[from] ParseError),
20
21 #[error("Could not find a file with hash {0}")]
23 UnknownHash(u64),
24
25 #[error("Hash is zero")]
27 NulHash,
28
29 #[error("External symbol `{0}` not found")]
31 ExternalSymbolNotFound(QualifiedName),
32
33 #[error("External path `{0}` not found")]
35 ExternalPathNotFound(std::path::PathBuf),
36
37 #[error("Could not find a file with path {0}")]
39 FileNotFound(std::path::PathBuf),
40
41 #[error("Symbol {0} not found.")]
43 SymbolNotFound(QualifiedName),
44
45 #[error("Symbol {0} must be loaded from {1}")]
47 SymbolMustBeLoaded(QualifiedName, std::path::PathBuf),
48
49 #[error("Defining a property is not allowed here ({0})")]
51 PropertyNotAllowed(SrcRef),
52
53 #[error("Symbol {0} is not a value")]
55 NotAValue(QualifiedName),
56
57 #[error("Declaration of {0} not allowed within {1}")]
59 DeclNotAllowed(Identifier, QualifiedName),
60}
61
62pub type ResolveResult<T> = std::result::Result<T, ResolveError>;