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
|
@ -70,7 +70,8 @@ impl XPathEvaluatorMethods<crate::DomTypeHolder> for XPathEvaluator {
|
|||
let window = global.as_window();
|
||||
// NB: this function is *not* Fallible according to the spec, so we swallow any parsing errors and
|
||||
// just pass a None as the expression... it's not great.
|
||||
let parsed_expression = crate::xpath::parse(&expression).map_err(|_e| Error::Syntax)?;
|
||||
let parsed_expression =
|
||||
crate::xpath::parse(&expression).map_err(|_e| Error::Syntax(None))?;
|
||||
Ok(XPathExpression::new(
|
||||
window,
|
||||
None,
|
||||
|
@ -97,7 +98,8 @@ impl XPathEvaluatorMethods<crate::DomTypeHolder> for XPathEvaluator {
|
|||
) -> Fallible<DomRoot<XPathResult>> {
|
||||
let global = self.global();
|
||||
let window = global.as_window();
|
||||
let parsed_expression = crate::xpath::parse(&expression_str).map_err(|_| Error::Syntax)?;
|
||||
let parsed_expression =
|
||||
crate::xpath::parse(&expression_str).map_err(|_| Error::Syntax(None))?;
|
||||
let expression = XPathExpression::new(window, None, can_gc, parsed_expression);
|
||||
XPathExpressionMethods::<crate::DomTypeHolder>::Evaluate(
|
||||
&*expression,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue