dpscript/error/
validator.rs

1use miette::{Diagnostic, NamedSource, SourceSpan};
2use thiserror::Error;
3
4#[derive(Debug, Error, Diagnostic)]
5#[error("An error occured while validating!")]
6#[diagnostic(code(dpscript::error::validator), url(docsrs))]
7pub struct ValidatorError {
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 while validating!")]
20#[diagnostic(code(dpscript::error::validator::duo), url(docsrs))]
21pub struct DuoValidatorError {
22    #[source_code]
23    pub src: NamedSource<String>,
24
25    #[label("here")]
26    pub at: SourceSpan,
27
28    #[label("here")]
29    pub other: SourceSpan,
30
31    #[help]
32    pub err: String,
33}
34
35#[derive(Debug, Error, Diagnostic)]
36#[error("An error occured while validating!")]
37#[diagnostic(code(dpscript::error::validator), url(docsrs))]
38pub struct UnnamedValidatorError {
39    #[source_code]
40    pub src: String,
41
42    #[label("here")]
43    pub at: SourceSpan,
44
45    #[help]
46    pub err: String,
47}
48
49#[derive(Debug, Error, Diagnostic)]
50#[error("An error occured while validating!")]
51#[diagnostic(code(dpscript::error::validator::duo), url(docsrs))]
52pub struct UnnamedDuoValidatorError {
53    #[source_code]
54    pub src: String,
55
56    #[label("here")]
57    pub at: SourceSpan,
58
59    #[label("here")]
60    pub other: SourceSpan,
61
62    #[help]
63    pub err: String,
64}
65
66#[derive(Debug, Error, Diagnostic)]
67#[error("An error occured while validating!")]
68#[diagnostic(code(dpscript::error::validator), url(docsrs))]
69pub struct UnsourcedValidatorError {
70    #[help]
71    pub err: String,
72}