1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! Filters update result models.
use crate::FilterId;
use crate::FullFilterList;
/// Filters update result container.
#[derive(Default)]
pub struct UpdateResult {
/// Currently updated filters.
/// `title` and `description` fields will be localised with current [`crate::Locale`]
pub updated_list: Vec<FullFilterList>,
/// Number of filters not updated due to timeout.
pub remaining_filters_count: i32,
/// List of entities containing the filter id and a string representation of the error
/// that occurred when processing or receiving the filter
pub filters_errors: Vec<UpdateFilterError>,
}
/// Container for filter updating error
pub struct UpdateFilterError {
/// ID of that filter tha couldn't be updated
pub filter_id: FilterId,
/// Filter error converted to a string. For debugging purposes
pub message: String,
/// Filter url
pub filter_url: Option<String>,
/// Http client error
pub http_client_error: Option<String>,
}
impl UpdateFilterError {
/// Creates a new [`UpdateFilterError`] only with the specified message.
pub const fn with_message(message: String) -> Self {
Self {
filter_id: 0,
message,
filter_url: None,
http_client_error: None,
}
}
}