use std::path::PathBuf;
use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum Error {
#[error("cannot read `{path}`: {source}")]
Io {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("the `dirs` list in a convention-lint check cannot be empty")]
EmptyDirs,
#[error("cannot parse `{path}`: {source}")]
Toml {
path: PathBuf,
#[source]
source: toml::de::Error,
},
#[error(
"`[workspace.metadata.convention-lint]` or `[package.metadata.convention-lint]` section not found in `{0}`"
)]
MissingSection(PathBuf),
#[error(
"`[workspace.metadata.convention-lint]` or `[package.metadata.convention-lint]` must be a TOML table"
)]
InvalidSection,
#[error(
"unknown convention `{value}` for pattern(s) [{context}]; \
valid values: `snake_case`, `CamelCase`, `camelCase`, \
`SCREAMING_SNAKE_CASE`, `kebab-case`"
)]
UnknownConvention {
context: String,
value: String,
},
}