mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-09-06 06:37:35 +08:00
chore: swap monkeyerror for error to not expose actual error message to the frontend
This commit is contained in:
parent
e06f7f41cf
commit
ab9cef010e
2 changed files with 7 additions and 11 deletions
|
@ -180,8 +180,7 @@ export class WeeklyXpLeaderboard {
|
|||
totalXp: parseInt(scoreValue, 10),
|
||||
};
|
||||
} catch (error) {
|
||||
throw new MonkeyError(
|
||||
500,
|
||||
throw new Error(
|
||||
`Failed to parse leaderboard entry at index ${index}: ${
|
||||
error instanceof Error ? error.message : String(error)
|
||||
}`
|
||||
|
@ -203,7 +202,7 @@ export class WeeklyXpLeaderboard {
|
|||
): Promise<XpLeaderboardEntry | null> {
|
||||
const connection = RedisClient.getConnection();
|
||||
if (!connection || !weeklyXpLeaderboardConfig.enabled) {
|
||||
throw new MonkeyError(500, "Redis connection is unavailable");
|
||||
throw new Error("Redis connection is unavailable");
|
||||
}
|
||||
|
||||
const { weeklyXpLeaderboardScoresKey, weeklyXpLeaderboardResultsKey } =
|
||||
|
@ -231,8 +230,7 @@ export class WeeklyXpLeaderboard {
|
|||
);
|
||||
|
||||
if (error) {
|
||||
throw new MonkeyError(
|
||||
500,
|
||||
throw new Error(
|
||||
`Failed to parse leaderboard entry: ${
|
||||
error instanceof Error ? error.message : String(error)
|
||||
}`
|
||||
|
|
|
@ -157,8 +157,7 @@ export class DailyLeaderboard {
|
|||
rank: minRank + index + 1,
|
||||
};
|
||||
} catch (error) {
|
||||
throw new MonkeyError(
|
||||
500,
|
||||
throw new Error(
|
||||
`Failed to parse leaderboard entry at index ${index}: ${
|
||||
error instanceof Error ? error.message : String(error)
|
||||
}`
|
||||
|
@ -203,7 +202,7 @@ export class DailyLeaderboard {
|
|||
): Promise<LeaderboardEntry | null> {
|
||||
const connection = RedisClient.getConnection();
|
||||
if (!connection || !dailyLeaderboardsConfig.enabled) {
|
||||
throw new MonkeyError(500, "Redis connection is unavailable");
|
||||
throw new Error("Redis connection is unavailable");
|
||||
}
|
||||
|
||||
const { leaderboardScoresKey, leaderboardResultsKey } =
|
||||
|
@ -235,8 +234,7 @@ export class DailyLeaderboard {
|
|||
rank: rank + 1,
|
||||
};
|
||||
} catch (error) {
|
||||
throw new MonkeyError(
|
||||
500,
|
||||
throw new Error(
|
||||
`Failed to parse leaderboard entry: ${
|
||||
error instanceof Error ? error.message : String(error)
|
||||
}`
|
||||
|
@ -247,7 +245,7 @@ export class DailyLeaderboard {
|
|||
public async getCount(): Promise<number> {
|
||||
const connection = RedisClient.getConnection();
|
||||
if (!connection) {
|
||||
throw new MonkeyError(500, "Redis connection is unavailable");
|
||||
throw new Error("Redis connection is unavailable");
|
||||
}
|
||||
|
||||
const { leaderboardScoresKey } = this.getTodaysLeaderboardKeys();
|
||||
|
|
Loading…
Add table
Reference in a new issue