diff --git a/floriday.js b/floriday.js index b180442..dd4580c 100644 --- a/floriday.js +++ b/floriday.js @@ -59,7 +59,7 @@ class Floriday { await utils.separator(`${cycle++} ${(cycle == 2 ? 'Cycle' : 'Cycles')}`); } catch (err) { - if (err?.original?.code === 'ER_SOCKET_UNEXPECTED_CLOSE' || (err?.message).substring(0, 24) === 'SequelizeConnectionError') + if (includes('ER_SOCKET_UNEXPECTED_CLOSE','ECONNREFUSED').includes(err?.original?.code) || (err?.message).substring(0, 24) === 'SequelizeConnectionError') throw err; utils.handler('critical', err); } diff --git a/utils.js b/utils.js index fc118d2..836208b 100644 --- a/utils.js +++ b/utils.js @@ -59,7 +59,7 @@ export async function checkToken(isForce) { optionalMsg = 'Using stored token...'; await okSpin(optionalMsg); } catch (err) { - await await failSpin(err); + await failSpin(err); } }; @@ -157,7 +157,7 @@ export async function syncModel(model) { const res = (await vnRequest('GET', `${env.API_URL}${methods[model].sync.url}${curSeqNum}${params ? `?${params}` : ''}`)); if (res?.response?.status == 403 && res?.response?.data?.title === 'There are no connected suppliers.') { // Forbidden - await await warnSpin(`Syncing ${model}...`, new Error(res.response.data.title)); + await warnSpin(`Syncing ${model}...`, new Error(res.response.data.title)); return; } @@ -174,7 +174,7 @@ export async function syncModel(model) { : `Syncing ${model}...`); await okSpin(); } catch (err) { - await await failSpin(err); + await failSpin(err); } }; @@ -781,7 +781,7 @@ export async function deleteConnections() { if (spinner && i) await okSpin(`Deleting ${i++} connections...`); } catch (err) { - await criticalSpin(err); + throw err; } };