rpg_chat_command_parser/errors.rs
1//! # Error Handling for RPG Chat Command Parser
2//!
3//! This module defines custom errors for the command parser, using the [`thiserror`](https://docs.rs/thiserror) crate.
4//!
5//! ## Errors
6//! - **`InvalidSyntax`**: Indicates a syntax error in the input command.
7//! - **`MissingFlagKey`**: A flag is missing its key.
8//! - **`MissingFlagValue`**: A flag is missing its value.
9//! - **`MissingVerb`**: The command is missing a verb.
10
11use thiserror::Error;
12
13/// Custom error type for command parsing errors.
14#[derive(Error, Debug)]
15pub enum CommandError {
16 /// The command syntax is invalid.
17 #[error("Invalid command syntax")]
18 InvalidSyntax,
19
20 /// A flag is missing its key.
21 #[error("Missing key in flag")]
22 MissingFlagKey,
23
24 /// A flag is missing its value.
25 #[error("Missing value in flag")]
26 MissingFlagValue,
27
28 /// The command is missing a verb.
29 #[error("Missing verb in command")]
30 MissingVerb,
31}