Fix Printer group modes (#6815)

This commit is contained in:
Micha Reiser 2023-08-24 08:42:59 +02:00 committed by GitHub
parent 205d234856
commit e4c13846e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 80 additions and 67 deletions

View file

@ -1,4 +1,5 @@
use crate::prelude::TagKind;
use crate::GroupId;
use ruff_text_size::TextRange;
use std::error::Error;
@ -86,7 +87,9 @@ pub enum InvalidDocumentError {
/// Text
/// EndGroup
/// ```
StartTagMissing { kind: TagKind },
StartTagMissing {
kind: TagKind,
},
/// Expected a specific start tag but instead is:
/// - at the end of the document
@ -96,6 +99,10 @@ pub enum InvalidDocumentError {
expected_start: TagKind,
actual: ActualStart,
},
UnknownGroupId {
group_id: GroupId,
},
}
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
@ -148,6 +155,9 @@ impl std::fmt::Display for InvalidDocumentError {
}
}
}
InvalidDocumentError::UnknownGroupId { group_id } => {
std::write!(f, "Encountered unknown group id {group_id:?}. Ensure that the group with the id {group_id:?} exists and that the group is a parent of or comes before the element referring to it.")
}
}
}
}