From 5f0a1e67c64082c848418daa2b51020eb42c5c12 Mon Sep 17 00:00:00 2001 From: Akshay Date: Mon, 25 Oct 2021 22:08:52 +0530 Subject: rework cli, use subcommands instead --- bin/src/err.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'bin/src/err.rs') diff --git a/bin/src/err.rs b/bin/src/err.rs index 727e0cc..5f71b57 100644 --- a/bin/src/err.rs +++ b/bin/src/err.rs @@ -8,9 +8,10 @@ use thiserror::Error; pub enum ConfigErr { #[error("error parsing glob `{0:?}`: {1}")] InvalidGlob(Option, ErrorKind), - #[error("path error: {0}")] InvalidPath(#[from] io::Error), + #[error("unable to parse `{0}` as line and column")] + InvalidPosition(String) } #[derive(Error, Debug)] @@ -27,12 +28,26 @@ pub enum FixErr { InvalidPath(#[from] io::Error), } +#[derive(Error, Debug)] +pub enum SingleFixErr { + #[error("path error: {0}")] + InvalidPath(#[from] io::Error), + #[error("position out of bounds: line {0}, col {1}")] + OutOfBounds(usize, usize), + #[error("{0} is too large")] + Conversion(usize), + #[error("nothing to fix")] + NoOp, +} + #[derive(Error, Debug)] pub enum StatixErr { #[error("linter error: {0}")] Lint(#[from] LintErr), #[error("fixer error: {0}")] Fix(#[from] FixErr), + #[error("single fix error: {0}")] + Single(#[from] SingleFixErr), #[error("config error: {0}")] Config(#[from] ConfigErr), } -- cgit v1.2.3