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:
Ashwin Naren 2025-09-01 22:51:36 -07:00 committed by GitHub
parent d01bba4e50
commit 97c8c83cbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 82 additions and 70 deletions

View file

@ -150,7 +150,7 @@ fn parse_font_face_descriptors(
if error_reporter.not_encountered_error.get() {
Ok(parsed_font_face_rule)
} else {
Err(Error::Syntax)
Err(Error::Syntax(None))
}
}
@ -191,7 +191,7 @@ impl FontFace {
let font_status_promise = Promise::new(global, can_gc);
// If any of them fail to parse correctly, reject font faces [[FontStatusPromise]] with a
// DOMException named "SyntaxError"
font_status_promise.reject_error(Error::Syntax, can_gc);
font_status_promise.reject_error(Error::Syntax(None), can_gc);
// set font faces corresponding attributes to the empty string, and set font faces status
// attribute to "error"