1
0
Fork 0

Better error handling

refactor/models
Bsian 2020-01-20 23:01:01 +00:00
parent 66d28e4e75
commit 4549da9ba3
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 8 additions and 4 deletions

View File

@ -23,10 +23,14 @@ export default function checkSS(client: Client) {
} }
} catch (error) { } catch (error) {
if (!hash) return; if (!hash) return;
const { status } = error.response; try {
if (status === 400 || status === 401 || status === 403 || status === 404) { const { status } = error.response;
await client.db.Account.updateOne({ userID }, { $set: { hash: false } }); if (status === 400 || status === 401 || status === 403 || status === 404) {
client.getDMChannel(userID).then((channel) => channel.createMessage('Your SecureSign password has been reset - please reinitialize your SecureSign account. Run `=securesign init` for more information')).catch(); await client.db.Account.updateOne({ userID }, { $set: { hash: false } });
client.getDMChannel(userID).then((channel) => channel.createMessage('Your SecureSign password has been reset - please reinitialize your SecureSign account. Run `=securesign init` for more information')).catch();
}
} catch (e) {
throw error;
} }
} }
} }