Skip to content

Commit 1a32067

Browse files
committed
lib: return undefined for localStorage when location is invalid
1 parent 412486f commit 1a32067

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/internal/webstorage.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ const {
44
} = primordials;
55
const { ERR_INVALID_ARG_VALUE } = require('internal/errors').codes;
66
const { getOptionValue } = require('internal/options');
7-
const { emitExperimentalWarning } = require('internal/util');
87
const { kConstructorKey, Storage } = internalBinding('webstorage');
98
const { getValidatedPath } = require('internal/fs/utils');
9+
const { emitWarning } = require('process');
1010
const kInMemoryPath = ':memory:';
1111

12-
emitExperimentalWarning('Web Storage');
13-
1412
module.exports = { Storage };
1513

1614
let lazyLocalStorage;
@@ -27,9 +25,9 @@ ObjectDefineProperties(module.exports, {
2725
const location = getOptionValue('--localstorage-file');
2826

2927
if (location === '') {
30-
throw new ERR_INVALID_ARG_VALUE('--localstorage-file',
31-
location,
32-
'is an invalid localStorage location');
28+
emitWarning(`${location} is an invalid localStorage location`);
29+
30+
return undefined;
3331
}
3432

3533
lazyLocalStorage = new Storage(kConstructorKey, getValidatedPath(location));

0 commit comments

Comments
 (0)