mozilla_readability/errors.rs
1use std::fmt;
2use std::error::Error;
3
4#[derive(Debug)]
5pub struct ParserError {
6 message: String,
7}
8
9impl Error for ParserError {}
10impl fmt::Display for ParserError {
11 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
12 write!(f, "ParserError: {}", self.message)
13 }
14}
15impl ParserError {
16 pub fn new(message: &str) -> ParserError {
17 ParserError {
18 message: message.to_string(),
19 }
20 }
21}