litcheck_lit/suite/
error.rs1use std::path::PathBuf;
2
3use litcheck::diagnostics::{Diagnostic, SourceSpan};
4
5use crate::test::TestConfigError;
6
7#[derive(Debug, Diagnostic, thiserror::Error)]
8pub enum TestSuiteError {
9 #[error(transparent)]
10 #[diagnostic(transparent)]
11 Config(#[from] TestConfigError),
12 #[error("failed to parse test suite configuration")]
13 #[diagnostic()]
14 Syntax {
15 #[label("{error}")]
16 span: Option<SourceSpan>,
17 #[source]
18 error: toml::de::Error,
19 },
20 #[error("invalid test suite configuration")]
21 #[diagnostic()]
22 EmptyName {
23 #[label("name cannot be empty")]
24 span: SourceSpan,
25 },
26 #[error("invalid test suite configuration")]
27 #[diagnostic()]
28 InvalidSourceDir {
29 #[label("source directory '{}' is not a directory", .source_dir.display())]
30 span: SourceSpan,
31 source_dir: PathBuf,
32 },
33 #[error("invalid test suite configuration")]
34 #[diagnostic()]
35 InvalidWorkingDir {
36 #[label("working directory '{}' is not a directory", .working_dir.display())]
37 span: SourceSpan,
38 working_dir: PathBuf,
39 },
40}