Skip to content

Commit

Permalink
[Fix] await issue and generic error
Browse files Browse the repository at this point in the history
  • Loading branch information
ptkdev committed Nov 6, 2021
1 parent 8950306 commit 94a741f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
16 changes: 10 additions & 6 deletions app/core/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ import logger from "@app/functions/utils/logger";

await db.connection.connectDB();

await commands.quit();
await commands.start();
await commands.about();
await commands.settings();
await commands.privacy();
await commands.hears();
try {
await commands.quit();
await commands.start();
await commands.about();
await commands.settings();
await commands.privacy();
await commands.hears();
} catch (error) {
logger.error(JSON.stringify(error || ""), "generic error: ");
}

await commands.launch();
})();
Expand Down
2 changes: 1 addition & 1 deletion app/functions/api/database/about.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const get = async (search: Record<string, number | string | boolean>): Promise<A
}
});

return about || new query().toJSON();
return (await about) || new query().toJSON();
} catch (error: any) {
logger.error(JSON.stringify(error || ""), "about.ts:get()");
}
Expand Down
2 changes: 1 addition & 1 deletion app/functions/api/database/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const get = async (search: Record<string, number | string | boolean>): Promise<S
}
});

return settings || new query().toJSON();
return (await settings) || new query().toJSON();
} catch (error: any) {
logger.error(JSON.stringify(error || ""), "settings.ts:get()");
}
Expand Down
2 changes: 1 addition & 1 deletion app/functions/api/database/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const get = async (search: Record<string, number | string | boolean>): Promise<T
}
});

return user || new query().toJSON();
return (await user) || new query().toJSON();
} catch (error: any) {
logger.error(JSON.stringify(error || ""), "users.ts:get()");
}
Expand Down

0 comments on commit 94a741f

Please sign in to comment.