commands: use new error variants for a few more commands

This commit is contained in:
2025-12-08 17:30:47 +09:00
parent 18b6baad71
commit 7f9f685e45
30 changed files with 413 additions and 102 deletions

View File

@@ -41,16 +41,24 @@ impl CommandRequest for PlChangesRequest {
}
fn parse(mut parts: RequestTokenizer<'_>) -> Result<Self, RequestParserError> {
let version = parts.next().ok_or(RequestParserError::UnexpectedEOF)?;
let version = parts.next().ok_or(Self::missing_arguments_error(0))?;
let version = version
.parse()
.map_err(|_| RequestParserError::SyntaxError(0, version.to_string()))?;
.map_err(|_| RequestParserError::SubtypeParserError {
argument_index: 0,
expected_type: "PlaylistVersion".to_string(),
raw_input: version.to_string(),
})?;
let window = parts
.next()
.map(|w| {
w.parse()
.map_err(|_| RequestParserError::SyntaxError(0, w.to_string()))
.map_err(|_| RequestParserError::SubtypeParserError {
argument_index: 1,
expected_type: "WindowRange".to_string(),
raw_input: w.to_string(),
})
})
.transpose()?;