mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
script: Add message to SyntaxError (#39056)
Adding an optional message to be attached to a SyntaxError. Unblocks #39050. The enum definition of Syntax is now `Syntax(Option<String>)`. Future PRs should probably add more appropriate messages to some of the `Syntax(None)`s. Testing: Just a refactor Fixes: Partially #39053 Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
This commit is contained in:
parent
d01bba4e50
commit
97c8c83cbb
30 changed files with 82 additions and 70 deletions
|
@ -64,7 +64,7 @@ impl DOMTokenList {
|
|||
|
||||
fn check_token_exceptions(&self, token: &str) -> Fallible<Atom> {
|
||||
match token {
|
||||
"" => Err(Error::Syntax),
|
||||
"" => Err(Error::Syntax(None)),
|
||||
slice if slice.find(HTML_SPACE_CHARACTERS).is_some() => Err(Error::InvalidCharacter),
|
||||
slice => Ok(Atom::from(slice)),
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ impl DOMTokenListMethods<crate::DomTypeHolder> for DOMTokenList {
|
|||
fn Replace(&self, token: DOMString, new_token: DOMString, can_gc: CanGc) -> Fallible<bool> {
|
||||
if token.is_empty() || new_token.is_empty() {
|
||||
// Step 1.
|
||||
return Err(Error::Syntax);
|
||||
return Err(Error::Syntax(None));
|
||||
}
|
||||
if token.contains(HTML_SPACE_CHARACTERS) || new_token.contains(HTML_SPACE_CHARACTERS) {
|
||||
// Step 2.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue