uci_parser/
error.rs

1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5 */
6
7use thiserror::Error;
8
9/// Errors that can occur when parsing a UCI command.
10#[derive(Error, Debug, PartialEq, Eq)]
11pub enum UciParseError {
12    /// The provided command could not be parsed and is likely not a UCI command.
13    #[error("unrecognized UCI command: {cmd:?}")]
14    UnrecognizedCommand { cmd: String },
15
16    /// The provided command is UCI, but was given invalid arguments.
17    #[error("invalid argument {arg:?} to {cmd:?}")]
18    InvalidArgument { cmd: String, arg: String },
19
20    /// The provided command is UCI, but was not given enough arguments
21    #[error("insufficient arguments for {cmd:?}")]
22    InsufficientArguments { cmd: String },
23}