sonar fixes

This commit is contained in:
Ean Milligan (Bastion) 2022-06-20 21:03:01 -04:00
parent 6e448907ee
commit 0cabfe0c99
1 changed files with 8 additions and 4 deletions

View File

@ -104,7 +104,7 @@ const handleRollWorker = async (rq: QueuedRoll) => {
apiErroredOut = true; apiErroredOut = true;
rq.api.requestEvent.respondWith( rq.api.requestEvent.respondWith(
new Response( new Response(
'Message failed to send.', 'Message failed to send - location 0.',
{ status: Status.InternalServerError, statusText: STATUS_TEXT.get(Status.InternalServerError) }, { status: Status.InternalServerError, statusText: STATUS_TEXT.get(Status.InternalServerError) },
), ),
); );
@ -127,7 +127,7 @@ const handleRollWorker = async (rq: QueuedRoll) => {
await sendDirectMessage(BigInt(gm.substring(2, gm.length - 1)), { await sendDirectMessage(BigInt(gm.substring(2, gm.length - 1)), {
file: gmEmbedDetails.attachment, file: gmEmbedDetails.attachment,
}).catch(() => { }).catch(() => {
if (rq.apiRoll && n) { if (n && rq.apiRoll) {
n.reply(generateDMFailed(gm)); n.reply(generateDMFailed(gm));
} else { } else {
rq.dd.message.reply(generateDMFailed(gm)); rq.dd.message.reply(generateDMFailed(gm));
@ -153,7 +153,7 @@ const handleRollWorker = async (rq: QueuedRoll) => {
apiErroredOut = true; apiErroredOut = true;
rq.api.requestEvent.respondWith( rq.api.requestEvent.respondWith(
new Response( new Response(
'Message failed to send.', 'Message failed to send - location 1.',
{ status: Status.InternalServerError, statusText: STATUS_TEXT.get(Status.InternalServerError) }, { status: Status.InternalServerError, statusText: STATUS_TEXT.get(Status.InternalServerError) },
), ),
); );
@ -172,7 +172,11 @@ const handleRollWorker = async (rq: QueuedRoll) => {
} }
} }
if (!apiErroredOut) { if (rq.apiRoll && !apiErroredOut) {
dbClient.execute(queries.insertRollLogCmd(1, 0), [rq.originalCommand, returnmsg.errorCode, n ? n.id : null]).catch((e) => {
log(LT.ERROR, `Failed to insert into DB: ${JSON.stringify(e)}`);
});
rq.api.requestEvent.respondWith( rq.api.requestEvent.respondWith(
new Response( new Response(
JSON.stringify( JSON.stringify(