File tree Expand file tree Collapse file tree 1 file changed +18
-20
lines changed
remote/webdriver-bidi/modules/root Expand file tree Collapse file tree 1 file changed +18
-20
lines changed Original file line number Diff line number Diff line change @@ -362,28 +362,26 @@ class EmulationModule extends RootBiDiModule {
362362 } = options ;
363363
364364 let locale ;
365- if ( localeArg !== undefined ) {
366- if ( localeArg === null ) {
367- // The API requires an empty string to reset the override.
368- locale = "" ;
369- } else {
370- locale = lazy . assert . string (
371- localeArg ,
372- lazy . pprint `Expected "locale" to be a string, got ${ localeArg } `
373- ) ;
374-
375- // Validate if locale is a structurally valid language tag.
376- try {
377- Intl . getCanonicalLocales ( localeArg ) ;
378- } catch ( err ) {
379- if ( err instanceof RangeError ) {
380- throw new lazy . error . InvalidArgumentError (
381- `Expected "locale" to be a structurally valid language tag (e.g., "en-GB"), got ${ localeArg } `
382- ) ;
383- }
365+ if ( localeArg === null ) {
366+ // The API requires an empty string to reset the override.
367+ locale = "" ;
368+ } else {
369+ locale = lazy . assert . string (
370+ localeArg ,
371+ lazy . pprint `Expected "locale" to be a string, got ${ localeArg } `
372+ ) ;
384373
385- throw err ;
374+ // Validate if locale is a structurally valid language tag.
375+ try {
376+ Intl . getCanonicalLocales ( localeArg ) ;
377+ } catch ( err ) {
378+ if ( err instanceof RangeError ) {
379+ throw new lazy . error . InvalidArgumentError (
380+ `Expected "locale" to be a structurally valid language tag (e.g., "en-GB"), got ${ localeArg } `
381+ ) ;
386382 }
383+
384+ throw err ;
387385 }
388386 }
389387
You can’t perform that action at this time.
0 commit comments