mirror of
https://github.com/nodejs/node.git
synced 2025-04-29 06:19:07 +00:00

* 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: https://github.com/nodejs/node/pull/56871 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
29 lines
602 B
JavaScript
29 lines
602 B
JavaScript
'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'
|
|
});
|