refs #4823 Handled more errors
This commit is contained in:
parent
17e3e4dfbf
commit
b3628cd2f1
|
@ -59,7 +59,7 @@ class Floriday {
|
||||||
|
|
||||||
await utils.separator(`${cycle++} ${(cycle == 2 ? 'Cycle' : 'Cycles')}`);
|
await utils.separator(`${cycle++} ${(cycle == 2 ? 'Cycle' : 'Cycles')}`);
|
||||||
} catch (err) {
|
} 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;
|
throw err;
|
||||||
utils.handler('critical', err);
|
utils.handler('critical', err);
|
||||||
}
|
}
|
||||||
|
|
8
utils.js
8
utils.js
|
@ -59,7 +59,7 @@ export async function checkToken(isForce) {
|
||||||
optionalMsg = 'Using stored token...';
|
optionalMsg = 'Using stored token...';
|
||||||
await okSpin(optionalMsg);
|
await okSpin(optionalMsg);
|
||||||
} catch (err) {
|
} 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}` : ''}`));
|
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
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ export async function syncModel(model) {
|
||||||
: `Syncing ${model}...`);
|
: `Syncing ${model}...`);
|
||||||
await okSpin();
|
await okSpin();
|
||||||
} catch (err) {
|
} 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...`);
|
if (spinner && i) await okSpin(`Deleting ${i++} connections...`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
await criticalSpin(err);
|
throw err;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue