feat: user error discrimination

This commit is contained in:
TrèsAbhi committed 2023-10-17 20:58:36 -05:00
1 parent f9e0584f00
commit 4b00e1342e
11 files changed
+49 -51

No files matched your search

@@ -2,7 +2,6 @@ import { RatingsInfo } from '../../commands/ratings';
import { Region } from '../../constants/regions';
import { DATABASE_REPO } from './getMidnightLeaderboard';
import { octokit } from './octokit';
import throwError from './throwError';
const ARCHIVED_RATINGS_CACHE: Record<
Region,
@@ -32,7 +31,7 @@ export default async function getArchivedRatingsInfo(
});
if (Array.isArray(data) || data.type !== 'file')
throw throwError('Archived ratings info is malformed');
throw new Error('Archived ratings info is malformed');
const content = Buffer.from(data.content, 'base64').toString();
const jsonContent = JSON.parse(content) as RatingsInfo & {
-3
View File
@@ -1,3 +0,0 @@
export default function throwError(message: string, cause?: string) {
return new Error(message, { cause });
}
+4
View File
@@ -0,0 +1,4 @@
/**
* Discriminator for user caused errors to not report in logs
*/
export class UserError extends Error {}