Merge pull request #1289 from hydralauncher/fix/handle-achievement-exception

fix: handle achievement exception
This commit is contained in:
Zamitto 2024-12-16 19:54:56 -03:00 committed by GitHub
commit 1acafe5b8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 541 additions and 380 deletions

View File

@ -34,24 +34,24 @@
"dependencies": {
"@electron-toolkit/preload": "^3.0.0",
"@electron-toolkit/utils": "^3.0.0",
"@fontsource/noto-sans": "^5.0.22",
"@hookform/resolvers": "^3.9.0",
"@fontsource/noto-sans": "^5.1.0",
"@hookform/resolvers": "^3.9.1",
"@primer/octicons-react": "^19.9.0",
"@reduxjs/toolkit": "^2.2.3",
"@vanilla-extract/css": "^1.14.2",
"@vanilla-extract/dynamic": "^2.1.1",
"@vanilla-extract/dynamic": "^2.1.2",
"@vanilla-extract/recipes": "^0.5.2",
"auto-launch": "^5.0.6",
"axios": "^1.7.7",
"better-sqlite3": "^11.3.0",
"axios": "^1.7.9",
"better-sqlite3": "^11.7.0",
"check-disk-space": "^3.4.0",
"classnames": "^2.5.1",
"color": "^4.2.3",
"color.js": "^1.2.0",
"create-desktop-shortcuts": "^1.11.0",
"date-fns": "^3.6.0",
"dexie": "^4.0.9",
"electron-log": "^5.2.0",
"dexie": "^4.0.10",
"electron-log": "^5.2.4",
"electron-updater": "^6.3.9",
"file-type": "^19.6.0",
"flexsearch": "^0.7.43",
@ -72,14 +72,14 @@
"sudo-prompt": "^9.2.1",
"tar": "^7.4.3",
"typeorm": "^0.3.20",
"user-agents": "^1.1.193",
"yaml": "^2.4.1",
"yup": "^1.4.0",
"zod": "^3.23.8"
"user-agents": "^1.1.387",
"yaml": "^2.6.1",
"yup": "^1.5.0",
"zod": "^3.24.1"
},
"devDependencies": {
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@commitlint/cli": "^19.6.0",
"@commitlint/config-conventional": "^19.6.0",
"@electron-toolkit/eslint-config-prettier": "^2.0.0",
"@electron-toolkit/eslint-config-ts": "^2.0.0",
"@electron-toolkit/tsconfig": "^1.0.1",
@ -87,8 +87,8 @@
"@types/auto-launch": "^5.0.5",
"@types/color": "^3.0.6",
"@types/folder-hash": "^4.0.4",
"@types/jsdom": "^21.1.6",
"@types/jsonwebtoken": "^9.0.6",
"@types/jsdom": "^21.1.7",
"@types/jsonwebtoken": "^9.0.7",
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.12.7",
"@types/parse-torrent": "^5.8.7",
@ -98,15 +98,15 @@
"@types/user-agents": "^1.0.4",
"@vanilla-extract/vite-plugin": "^4.0.7",
"@vitejs/plugin-react": "^4.2.1",
"electron": "^30.3.0",
"electron": "^31.7.6",
"electron-builder": "^25.1.8",
"electron-vite": "^2.0.0",
"eslint": "^8.56.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^9.0.11",
"prettier": "^3.2.4",
"husky": "^9.1.7",
"prettier": "^3.4.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sass-embedded": "^1.80.6",

View File

@ -236,6 +236,7 @@ export class AchievementWatcherManager {
};
public static preSearchAchievements = async () => {
try {
const newAchievementsCount =
process.platform === "win32"
? await this.preSearchAchievementsWindows()
@ -255,6 +256,9 @@ export class AchievementWatcherManager {
totalNewGamesWithAchievements
);
}
} catch (err) {
achievementsLogger.error("Error on preSearchAchievements", err);
}
this.hasFinishedMergingWithRemote = true;
};

View File

@ -9,6 +9,7 @@ export const parseAchievementFile = (
): UnlockedAchievement[] => {
if (!existsSync(filePath)) return [];
try {
if (type == Cracker.codex) {
const parsed = iniParse(filePath);
return processDefault(parsed);
@ -78,10 +79,13 @@ export const parseAchievementFile = (
`Unprocessed ${type} achievements found on ${filePath}`
);
return [];
} catch (err) {
achievementsLogger.error(`Error parsing ${type} - ${filePath}`, err);
return [];
}
};
const iniParse = (filePath: string) => {
try {
const fileContent = readFileSync(filePath, "utf-8");
const lines =
@ -105,23 +109,13 @@ const iniParse = (filePath: string) => {
}
return object;
} catch (err) {
achievementsLogger.error(`Error parsing ${filePath}`, err);
return {};
}
};
const jsonParse = (filePath: string) => {
try {
return JSON.parse(readFileSync(filePath, "utf-8"));
} catch (err) {
achievementsLogger.error(`Error parsing ${filePath}`, err);
return {};
}
};
const processRazor1911 = (filePath: string): UnlockedAchievement[] => {
try {
const fileContent = readFileSync(filePath, "utf-8");
const lines =
@ -143,10 +137,6 @@ const processRazor1911 = (filePath: string): UnlockedAchievement[] => {
}
return achievements;
} catch (err) {
achievementsLogger.error(`Error processing ${filePath}`, err);
return [];
}
};
const processOnlineFix = (unlockedAchievements: any): UnlockedAchievement[] => {

621
yarn.lock

File diff suppressed because it is too large Load Diff