From 858ee1f1ecf6e65f4b8c7f16a5b881e1ff306963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 31 Dec 2016 15:00:52 +0100 Subject: [PATCH] style: Document the error_reporting module. --- components/style/error_reporting.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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; } +/// 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) {