From e3b3f8fac14fb4c4d150fb31c11ead1a193a36e0 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 14 Apr 2019 04:17:24 +0900 Subject: Better error handling --- src/tools/add-emoji.ts | 4 ++-- src/tools/show-signin-history.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/tools') diff --git a/src/tools/add-emoji.ts b/src/tools/add-emoji.ts index a75798bdad..3745b48889 100644 --- a/src/tools/add-emoji.ts +++ b/src/tools/add-emoji.ts @@ -18,8 +18,8 @@ const args = process.argv.slice(2); const name = args[0]; const url = args[1]; -if (!name) throw 'require name'; -if (!url) throw 'require url'; +if (!name) throw new Error('require name'); +if (!url) throw new Error('require url'); main(name, url).then(() => { console.log('success'); diff --git a/src/tools/show-signin-history.ts b/src/tools/show-signin-history.ts index 9e6e849f5d..fd7cd39e38 100644 --- a/src/tools/show-signin-history.ts +++ b/src/tools/show-signin-history.ts @@ -15,7 +15,7 @@ async function main(username: string, headers?: string[]) { usernameLower: username.toLowerCase(), }); - if (user == null) throw 'User not found'; + if (user == null) throw new Error('User not found'); const history = await Signins.find({ userId: user.id -- cgit v1.2.3-freya