ephemeris_documents/error/text.rs
1//! Errors from plain text documents.
2
3/// Error returned while rendering a plain text document's comment nodes.
4#[derive(Debug, Clone, Copy, thiserror::Error)]
5pub enum TextError {
6 /// A text document has comment nodes but no `commentSyntax` was selected.
7 #[error("document has comment nodes but no comment syntax")]
8 CommentSyntaxMissing,
9 /// An XML comment's text would contain its own closing delimiter.
10 #[error("XML comment contains its own closing delimiter (`-->`)")]
11 XmlCommentContainsCloser,
12 /// A comment node contains a carriage return.
13 #[error("comment contains a carriage return, but comments must use LF line endings")]
14 CommentNotLf,
15 /// A comment node contains a control character other than a line feed or
16 /// a tab, or a Unicode line or paragraph separator.
17 #[error("comment contains the character {character:?}, which would corrupt the output")]
18 CommentCharacter {
19 /// The first offending character.
20 character: char,
21 },
22 /// A comment node follows text that does not end a line.
23 #[error("comment follows text that does not end with a line break")]
24 CommentMidLine,
25}