From 671fd4c88b7548081a0514627c4ffdec59559ad7 Mon Sep 17 00:00:00 2001 From: Leonid Pospelov Date: Mon, 10 Jun 2024 01:15:44 +0500 Subject: [PATCH 1/2] fix(skymp5-client): fix error handling in load order verification --- .../services/loadOrderVerificationService.ts | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/skymp5-client/src/services/services/loadOrderVerificationService.ts b/skymp5-client/src/services/services/loadOrderVerificationService.ts index 31555fe87c..10f7449c65 100644 --- a/skymp5-client/src/services/services/loadOrderVerificationService.ts +++ b/skymp5-client/src/services/services/loadOrderVerificationService.ts @@ -3,6 +3,7 @@ import { getServerIp, getServerUiPort } from "./skympClient"; import { getScreenResolution } from "../../view/formView"; import { ClientListener, CombinedController, Sp } from "./clientListener"; import { Mod, ServerManifest } from "../messages_http/serverManifest"; +import { logTrace } from "src/logging"; const STATE_KEY = 'loadOrderCheckState'; @@ -136,7 +137,7 @@ export class LoadOrderVerificationService extends ClientListener { const result = []; for (let i = 0; i < getCount(); ++i) { const filename = getAt(i); - const { crc32, size } = this.sp.getFileInfo(filename); + const { crc32, size } = this.getFileInfoSafe(filename); result.push({ filename, crc32, size }); } return result; @@ -152,4 +153,24 @@ export class LoadOrderVerificationService extends ClientListener { printConsole(`#${i} ${JSON.stringify(mod)}`); } }; + + private getFileInfoSafe(filename: string) { + try { + return this.sp.getFileInfo(filename); + } + catch (e) { + // InvalidArgumentException.h, Skyrim Platform + const searchString = 'is not a valid argument'; + + const message = (e as Record).message; + + if (typeof message === "string" && message.includes('is not a valid argument')) { + logTrace(this, `Failed to get file info for`, filename); + return { crc32: 0, size: 0 }; + } + else { + throw e; + } + } + } } From 053f67ff360297ca139ddde1bcc4aadc7c77da55 Mon Sep 17 00:00:00 2001 From: Leonid Pospelov Date: Mon, 10 Jun 2024 01:26:35 +0500 Subject: [PATCH 2/2] . --- .../src/services/services/loadOrderVerificationService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skymp5-client/src/services/services/loadOrderVerificationService.ts b/skymp5-client/src/services/services/loadOrderVerificationService.ts index 10f7449c65..8558f4aa38 100644 --- a/skymp5-client/src/services/services/loadOrderVerificationService.ts +++ b/skymp5-client/src/services/services/loadOrderVerificationService.ts @@ -3,7 +3,7 @@ import { getServerIp, getServerUiPort } from "./skympClient"; import { getScreenResolution } from "../../view/formView"; import { ClientListener, CombinedController, Sp } from "./clientListener"; import { Mod, ServerManifest } from "../messages_http/serverManifest"; -import { logTrace } from "src/logging"; +import { logTrace } from "../../logging"; const STATE_KEY = 'loadOrderCheckState';