Better error handling
This commit is contained in:
@ -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');
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user