diff --git a/back/methods/osticket/closeTicket.js b/back/methods/osticket/closeTicket.js index ad2af75b7..c2f6aab1e 100644 --- a/back/methods/osticket/closeTicket.js +++ b/back/methods/osticket/closeTicket.js @@ -98,7 +98,7 @@ module.exports = Self => { for (const ticketId of ticketsId) { try { const lockCode = await getLockCode(token, secondCookie, ticketId); - if (lockCode == false) continue; + if (!lockCode) throw new Error(`Can't get lock code`); let form = new FormData(); form.append('__CSRFToken__', token); form.append('id', ticketId); @@ -123,7 +123,7 @@ module.exports = Self => { } catch (e) { const err = new Error(`${ticketId} Ticket close failed: ${e.message}`); err.stack += e.stack; - throw err; + console.error(err); } } } @@ -141,7 +141,7 @@ module.exports = Self => { const body = await response.text(); const json = JSON.parse(body); - return json.code || json.retry; + return json.code || null; } }; };