mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Document the error_reporting module.
This commit is contained in:
parent
4108ff8383
commit
858ee1f1ec
1 changed files with 13 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue