sitemap_rs/
url_set_error.rs1use std::error::Error;
2use std::fmt::{Display, Formatter};
3
4#[derive(Debug)]
6pub enum UrlSetError {
7 TooManyUrls(usize),
9
10 TooMuchNews(usize),
12}
13
14impl Error for UrlSetError {}
15
16impl Display for UrlSetError {
17 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
18 match self {
19 Self::TooManyUrls(count) => {
20 write!(f, "must not contain more than 50,000 URLs: {count}")
21 }
22 Self::TooMuchNews(count) => {
23 write!(f, "must not contains more than 1,000 news URLs: {count}")
24 }
25 }
26 }
27}