dpscript/error/
compiler.rs

1use miette::{Diagnostic, NamedSource, SourceSpan};
2use thiserror::Error;
3
4#[derive(Debug, Error, Diagnostic)]
5#[error("An error occured during compilation!")]
6#[diagnostic(code(dpscript::error::compiler), url(docsrs))]
7pub struct CompilerError {
8    #[source_code]
9    pub src: NamedSource<String>,
10
11    #[label("here")]
12    pub at: SourceSpan,
13
14    #[help]
15    pub err: String,
16}
17
18#[derive(Debug, Error, Diagnostic)]
19#[error("An error occured during compilation!")]
20#[diagnostic(code(dpscript::error::compiler), url(docsrs))]
21pub struct UnnamedCompilerError {
22    #[source_code]
23    pub src: String,
24
25    #[label("here")]
26    pub at: SourceSpan,
27
28    #[help]
29    pub err: String,
30}
31
32#[derive(Debug, Error, Diagnostic)]
33#[error("An error occured during compilation!")]
34#[diagnostic(code(dpscript::error::compiler), url(docsrs))]
35pub struct UnsourcedCompilerError {
36    #[help]
37    pub err: String,
38}