From dd1dacfe304e0b6422b12cfa358fd7e6919164aa Mon Sep 17 00:00:00 2001 From: Bsian Date: Sat, 4 Jan 2020 14:06:10 +0000 Subject: [PATCH] Promises --- src/commands/parseall.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/parseall.ts b/src/commands/parseall.ts index 755b981..97b6428 100644 --- a/src/commands/parseall.ts +++ b/src/commands/parseall.ts @@ -37,10 +37,10 @@ export default class Parseall extends Command { return parseCertificate(this.client, `${a.homepath}/Validation/${certFile}`); }); // @ts-ignore - const parsed: {status: 'fulfilled', value: Certificate}[] | {status: 'rejected', reason: Error}[] = await Promise.allSettled(certificates); + const parsed: Promise<{status: 'fulfilled', value: Certificate}>[] | Promise<{status: 'rejected', reason: Error}>[] = await Promise.allSettled(certificates); const final = search.map(async (a) => { - const result = parsed[search.findIndex((acc) => acc === a)]; + const result = await parsed[search.findIndex((acc) => acc === a)]; if (result.status === 'rejected') { if (result.reason.message.includes('no such file or directory') || result.reason.message.includes('File doesn\'t exist.')) return `${this.client.stores.emojis.error} **${a.username}** Unable to locate certificate`; if (result.reason.message.includes('panic: Certificate PEM Encode == nil')) return `${this.client.stores.emojis.error} ** ${a.username}** Invalid certificate`;