From d6ec1d6a6ccab7c0bf6b69d3150e12a5b9ce4d07 Mon Sep 17 00:00:00 2001 From: Bsian Date: Sun, 29 Mar 2020 22:59:21 +0100 Subject: [PATCH] More bug fixes --- src/commands/cwg_create.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/commands/cwg_create.ts b/src/commands/cwg_create.ts index ce53fa5..33d009f 100644 --- a/src/commands/cwg_create.ts +++ b/src/commands/cwg_create.ts @@ -126,9 +126,8 @@ export default class CWG_Create extends Command { return Promise.all(completed); } catch (err) { - await fs.unlink(`/etc/nginx/sites-available/${args[1]}`); - await fs.unlink(`/etc/nginx/sites-enabled/${args[1]}`); - await this.client.db.Domain.deleteMany({ domain: args[1] }); + const tasks = [fs.unlink(`/etc/nginx/sites-enabled/${args[1]}`), fs.unlink(`/etc/nginx/sites-available/${args[1]}`), this.client.db.Domain.deleteMany({ domain: args[1] })]; + await Promise.allSettled(tasks); return this.client.util.handleError(err, message, this); } } @@ -182,7 +181,7 @@ export default class CWG_Create extends Command { } catch (error) { const tasks = [fs.unlink(`/etc/nginx/sites-enabled/${domain}`), fs.unlink(`/etc/nginx/sites-available/${domain}`), this.client.db.Domain.deleteMany({ domain })]; await Promise.allSettled(tasks); - return Promise.reject(error); + throw error; } }