-
Notifications
You must be signed in to change notification settings - Fork 30.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: make multiple improvements to node_url_pattern
* remove USE from node_url_pattern to handle error correctly * simplify if block in node_url_pattern * improve error handling in node_url_pattern * fix error propagation on URLPattern init * use ToV8Value where more convenient in node_url_pattern * simplify URLPatternInit::ToJsObject by reducing boilerplate PR-URL: #56871 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
- Loading branch information
Showing
3 changed files
with
94 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
|
||
const { throws } = require('assert'); | ||
const { URLPattern } = require('url'); | ||
|
||
// Verify that if an error is thrown while accessing any of the | ||
// init options, the error is appropriately propagated. | ||
throws(() => { | ||
new URLPattern({ | ||
get protocol() { | ||
throw new Error('boom'); | ||
} | ||
}); | ||
}, { | ||
message: 'boom', | ||
}); | ||
|
||
// Verify that if an error is thrown while accessing the ignoreCase | ||
// option, the error is appropriately propagated. | ||
throws(() => { | ||
new URLPattern({}, { get ignoreCase() { | ||
throw new Error('boom'); | ||
} }); | ||
}, { | ||
message: 'boom' | ||
}); |