More bug fixes

merge-requests/4/head
Bsian 2020-03-29 22:59:21 +01:00
parent f55db08f36
commit d6ec1d6a6c
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 3 additions and 4 deletions

View File

@ -126,9 +126,8 @@ export default class CWG_Create extends Command {
return Promise.all(completed); return Promise.all(completed);
} catch (err) { } catch (err) {
await fs.unlink(`/etc/nginx/sites-available/${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 fs.unlink(`/etc/nginx/sites-enabled/${args[1]}`); await Promise.allSettled(tasks);
await this.client.db.Domain.deleteMany({ domain: args[1] });
return this.client.util.handleError(err, message, this); return this.client.util.handleError(err, message, this);
} }
} }
@ -182,7 +181,7 @@ export default class CWG_Create extends Command {
} catch (error) { } catch (error) {
const tasks = [fs.unlink(`/etc/nginx/sites-enabled/${domain}`), fs.unlink(`/etc/nginx/sites-available/${domain}`), this.client.db.Domain.deleteMany({ domain })]; 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); await Promise.allSettled(tasks);
return Promise.reject(error); throw error;
} }
} }