refactor: uopdate NotFound error type

This commit is contained in:
ThetaDev 2023-05-08 15:21:06 +02:00
parent 289b1cdbf4
commit c021496a55
10 changed files with 119 additions and 137 deletions

View file

@ -163,18 +163,22 @@ impl RustyPipeQuery {
.await
{
Ok(target) => Ok(target),
Err(Error::Extraction(ExtractionError::ContentUnavailable(e))) => {
match util::VIDEO_ID_REGEX.is_match(id) {
true => Ok(UrlTarget::Video {
id: id.to_owned(),
start_time: get_start_time(),
}),
false => Err(Error::Extraction(
ExtractionError::ContentUnavailable(e),
)),
Err(e) => {
if matches!(
e,
Error::Extraction(ExtractionError::NotFound { .. })
) {
match util::VIDEO_ID_REGEX.is_match(id) {
true => Ok(UrlTarget::Video {
id: id.to_owned(),
start_time: get_start_time(),
}),
false => Err(e),
}
} else {
Err(e)
}
}
Err(e) => Err(e),
}
} else if util::VIDEO_ID_REGEX.is_match(id) {
Ok(UrlTarget::Video {