commands: extend parser errors
This commit is contained in:
@@ -34,6 +34,7 @@ pub use playback_options::*;
|
||||
pub use querying_mpd_status::*;
|
||||
pub use queue::*;
|
||||
pub use reflection::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
pub use stickers::*;
|
||||
pub use stored_playlists::*;
|
||||
|
||||
@@ -488,19 +489,30 @@ pub(crate) use single_item_command_request;
|
||||
pub(crate) use single_item_command_response;
|
||||
pub(crate) use single_optional_item_command_request;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Error, Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum RequestParserError {
|
||||
#[error("Could not parse the request due to a syntax error at position {0}: {1}")]
|
||||
SyntaxError(u64, String),
|
||||
|
||||
#[error("A command list was expected to be closed, but the end was not found at line {0}")]
|
||||
MissingCommandListEnd(u64),
|
||||
|
||||
#[error("A command list was found inside another command list at line {0}")]
|
||||
NestedCommandList(u64),
|
||||
|
||||
#[error("A command list was closed unexpectedly at line {0}")]
|
||||
UnexpectedCommandListEnd(u64),
|
||||
|
||||
#[error("Request ended early, while more arguments were expected")]
|
||||
UnexpectedEOF,
|
||||
MissingNewline,
|
||||
|
||||
// #[error("Request is missing terminating newline")]
|
||||
// MissingNewline,
|
||||
}
|
||||
|
||||
// TODO: should these be renamed to fit the mpd docs?
|
||||
// "Attribute" instead of "Property"?
|
||||
#[derive(Error, Debug, Clone, PartialEq)]
|
||||
#[derive(Error, Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum ResponseParserError {
|
||||
#[error("A property was expected to be present in the response, but was not found: {0}")]
|
||||
MissingProperty(String),
|
||||
@@ -525,6 +537,8 @@ pub enum ResponseParserError {
|
||||
|
||||
#[error("Response ended early, while more properties were expected")]
|
||||
UnexpectedEOF,
|
||||
|
||||
// #[error("Response is missing terminating newline")]
|
||||
// MissingNewline,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user