FIX: not deleting failed connection when it comes from request body

This commit is contained in:
rodrigo.zamboni
2022-09-01 12:41:46 -03:00
parent 2968647e73
commit 61296555fe
@@ -89,13 +89,15 @@ export class ConnectionTestService {
plugin,
}),
).catch(async (e) => {
await this.connectionsService.deleteConnection({
body: { id: connection_id },
info: { customer_id, customer_name, user_id },
});
if (!body.connection_id) {
await this.connectionsService.deleteConnection({
body: { id: connection_id },
info: { customer_id, customer_name, user_id },
});
}
throw e;
});
if (!operation_result) {
if (!operation_result && !body.connection_id) {
await this.connectionsService.deleteConnection({
body: { id: connection_id },
info: { customer_id, customer_name, user_id },