mirror of https://github.com/waku-org/js-waku.git
Catch nick promise failure
This commit is contained in:
parent
4542e01f0e
commit
0241d9edf3
|
@ -31,12 +31,17 @@ const ChatContentTopic = 'dingpu';
|
||||||
output: process.stdout,
|
output: process.stdout,
|
||||||
});
|
});
|
||||||
|
|
||||||
const question = util.promisify(rl.question).bind(rl);
|
let nick = 'js-waku';
|
||||||
// Looks like wrong type definition of promisify is picked.
|
try {
|
||||||
// May be related to https://github.com/DefinitelyTyped/DefinitelyTyped/issues/20497
|
const question = util.promisify(rl.question).bind(rl);
|
||||||
const nick = ((await question(
|
// Looks like wrong type definition of promisify is picked.
|
||||||
'Please choose a nickname: '
|
// May be related to https://github.com/DefinitelyTyped/DefinitelyTyped/issues/20497
|
||||||
)) as unknown) as string;
|
nick = ((await question(
|
||||||
|
'Please choose a nickname: '
|
||||||
|
)) as unknown) as string;
|
||||||
|
} catch (e) {
|
||||||
|
console.log('Using default nick.');
|
||||||
|
}
|
||||||
|
|
||||||
console.log(`Hi, ${nick}!`);
|
console.log(`Hi, ${nick}!`);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue