Skip to content

Commit ebbf345

Browse files
authored
Merge pull request #4 from notEduardo/debug
better error logs
2 parents cf85bb7 + c2f62c0 commit ebbf345

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/routes/rateLimitRoute.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ router.post('/rate-limits', async (req, res, next) => {
1111
const newRateLimit = await rateLimits.createRateLimit(key, timestamps);
1212
res.status(201).json(newRateLimit);
1313
} catch (error) {
14+
console.error(`Error creating rate limit for key "${key}":`, error);
1415
next(error); // Pass errors to global error handler
1516
}
1617
});
@@ -24,9 +25,11 @@ router.get('/rate-limits/:key', async (req, res, next) => {
2425
if (rateLimit) {
2526
res.status(200).json(rateLimit);
2627
} else {
28+
console.warn(`Rate limit not found for key "${key}"`);
2729
res.status(404).json({ message: 'Rate limit not found' });
2830
}
2931
} catch (error) {
32+
console.error(`Error retrieving rate limit for key "${key}":`, error);
3033
next(error);
3134
}
3235
});
@@ -41,9 +44,11 @@ router.put('/rate-limits/:key', async (req, res, next) => {
4144
if (updatedRateLimit) {
4245
res.status(200).json(updatedRateLimit);
4346
} else {
47+
console.warn(`Rate limit not found for key "${key}"`);
4448
res.status(404).json({ message: 'Rate limit not found' });
4549
}
4650
} catch (error) {
51+
console.error(`Error updating rate limit for key "${key}":`, error);
4752
next(error);
4853
}
4954
});

src/routes/solanaBalancesRoute.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ router.post('/solana-balances', async (req, res, next) => {
1111
const newBalance = await solanaBalances.createSolanaBalance(account, balance);
1212
res.status(201).json(newBalance);
1313
} catch (error) {
14+
console.error(`Error creating Solana balance for account: ${account}, Error: ${error.message}`);
1415
next(error);
1516
}
1617
});
@@ -23,6 +24,7 @@ router.get('/solana-balances/account/:account', async (req, res, next) => {
2324
const balances = await solanaBalances.getSolanaBalancesByAccount(account);
2425
res.status(200).json(balances);
2526
} catch (error) {
27+
console.error(`Error retrieving Solana balances for account: ${account}, Error: ${error.message}`);
2628
next(error);
2729
}
2830
});
@@ -33,9 +35,9 @@ router.get('/solana-balances/recent', async (req, res, next) => {
3335
const recentBalances = await solanaBalances.getRecentBalances();
3436
res.status(200).json(recentBalances);
3537
} catch (error) {
38+
console.error(`Error retrieving recent Solana balances, Error: ${error.message}`);
3639
next(error);
3740
}
3841
});
3942

40-
4143
export default router;

0 commit comments

Comments
 (0)