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
|
@ -274,7 +274,7 @@ impl LocationMethods<crate::DomTypeHolder> for Location {
|
|||
let base_url = self.entry_settings_object().api_base_url();
|
||||
let url = match base_url.join(&url.0) {
|
||||
Ok(url) => url,
|
||||
Err(_) => return Err(Error::Syntax),
|
||||
Err(_) => return Err(Error::Syntax(None)),
|
||||
};
|
||||
|
||||
Ok(Some(url))
|
||||
|
@ -304,7 +304,7 @@ impl LocationMethods<crate::DomTypeHolder> for Location {
|
|||
let base_url = self.entry_settings_object().api_base_url();
|
||||
let url = match base_url.join(&url.0) {
|
||||
Ok(url) => url,
|
||||
Err(_) => return Err(Error::Syntax),
|
||||
Err(_) => return Err(Error::Syntax(None)),
|
||||
};
|
||||
// Step 3: Location-object navigate to the resulting URL record with
|
||||
// the replacement flag set.
|
||||
|
@ -504,7 +504,7 @@ impl LocationMethods<crate::DomTypeHolder> for Location {
|
|||
|
||||
if copy_url.as_mut_url().set_scheme(scheme).is_err() {
|
||||
// Step 5: If possibleFailure is failure, then throw a "SyntaxError" DOMException.
|
||||
return Err(Error::Syntax);
|
||||
return Err(Error::Syntax(None));
|
||||
}
|
||||
|
||||
// Step 6: If copyURL's scheme is not an HTTP(S) scheme, then terminate these steps.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue