aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/style/error_reporting.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/components/style/error_reporting.rs b/components/style/error_reporting.rs
index 17d4ce7bb00..3a802bdd6c6 100644
--- a/components/style/error_reporting.rs
+++ b/components/style/error_reporting.rs
@@ -4,14 +4,27 @@
//! Types used to report parsing errors.
+#![deny(missing_docs)]
+
use cssparser::{Parser, SourcePosition};
use log;
+/// A generic trait for an error reporter.
pub trait ParseErrorReporter {
+ /// Called the style engine detects an error.
+ ///
+ /// Returns the current input being parsed, the source position it was
+ /// reported from, and a message.
fn report_error(&self, input: &mut Parser, position: SourcePosition, message: &str);
+ /// Clone this error reporter.
+ ///
+ /// TODO(emilio): I'm pretty sure all the box shenanigans can go away.
fn clone(&self) -> Box<ParseErrorReporter + Send + Sync>;
}
+/// An error reporter that reports the errors to the `info` log channel.
+///
+/// TODO(emilio): The name of this reporter is a lie, and should be renamed!
pub struct StdoutErrorReporter;
impl ParseErrorReporter for StdoutErrorReporter {
fn report_error(&self, input: &mut Parser, position: SourcePosition, message: &str) {