aboutsummaryrefslogtreecommitdiff
path: root/build/index.js
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2021-05-27 21:10:51 -0500
committermat <github@matdoes.dev>2021-05-27 21:10:51 -0500
commit65d21ebe1ead9faa2e1dc6ccad0d24e990632627 (patch)
tree1f2811547398f23353655792eaf722ccd225a9b5 /build/index.js
parentf2f18c27d2e849fdc3b2a6766dc6ab4005cde7df (diff)
downloadskyblock-api-65d21ebe1ead9faa2e1dc6ccad0d24e990632627.tar.gz
skyblock-api-65d21ebe1ead9faa2e1dc6ccad0d24e990632627.tar.bz2
skyblock-api-65d21ebe1ead9faa2e1dc6ccad0d24e990632627.zip
fix some bugs with it loading forever
Diffstat (limited to 'build/index.js')
-rw-r--r--build/index.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/build/index.js b/build/index.js
index fb2789d..dd6c3b6 100644
--- a/build/index.js
+++ b/build/index.js
@@ -54,13 +54,25 @@ app.get('/', async (req, res) => {
res.json({ ok: true });
});
app.get('/player/:user', async (req, res) => {
- res.json(await hypixel_1.fetchUser({ user: req.params.user }, [req.query.basic === 'true' ? undefined : 'profiles', 'player'], req.query.customization === 'true'));
+ try {
+ res.json(await hypixel_1.fetchUser({ user: req.params.user }, [req.query.basic === 'true' ? undefined : 'profiles', 'player'], req.query.customization === 'true'));
+ }
+ catch (err) {
+ console.error(err);
+ res.json({ 'error': true });
+ }
});
app.get('/discord/:id', async (req, res) => {
res.json(await database_1.fetchAccountFromDiscord(req.params.id));
});
app.get('/player/:user/:profile', async (req, res) => {
- res.json(await hypixel_1.fetchMemberProfile(req.params.user, req.params.profile, req.query.customization === 'true'));
+ try {
+ res.json(await hypixel_1.fetchMemberProfile(req.params.user, req.params.profile, req.query.customization === 'true'));
+ }
+ catch (err) {
+ console.error(err);
+ res.json({ 'error': true });
+ }
});
app.get('/player/:user/:profile/leaderboards', async (req, res) => {
res.json(await database_1.fetchMemberLeaderboardSpots(req.params.user, req.params.profile));