v0.5.5 — Fix ERR_FILE_NOT_FOUND log spam in resource swapper
Wrap net.fetch() in the kpc-swap protocol handler with try/catch and return a 404 response on failure instead of letting the error propagate as an uncaught promise rejection. Revert workflow cache changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "krunker-civilian-client",
|
"name": "krunker-civilian-client",
|
||||||
"version": "0.5.4",
|
"version": "0.5.5",
|
||||||
"description": "Cross-platform Krunker game client",
|
"description": "Cross-platform Krunker game client",
|
||||||
"main": "dist/main/index.js",
|
"main": "dist/main/index.js",
|
||||||
"homepage": "https://gitea.crjlab.net/bigjakk/krunker-civilian-client",
|
"homepage": "https://gitea.crjlab.net/bigjakk/krunker-civilian-client",
|
||||||
|
|||||||
+6
-2
@@ -35,7 +35,7 @@ export function initSwapperProtocol(): void {
|
|||||||
* Must be called AFTER app.ready.
|
* Must be called AFTER app.ready.
|
||||||
*/
|
*/
|
||||||
export function registerSwapperFileProtocol(ses: Session): void {
|
export function registerSwapperFileProtocol(ses: Session): void {
|
||||||
ses.protocol.handle(PROTOCOL_NAME, (request) => {
|
ses.protocol.handle(PROTOCOL_NAME, async (request) => {
|
||||||
const url = new URL(request.url);
|
const url = new URL(request.url);
|
||||||
// Reconstruct the file path from the URL
|
// Reconstruct the file path from the URL
|
||||||
// Windows: kpc-swap://C/foo/bar → C:/foo/bar
|
// Windows: kpc-swap://C/foo/bar → C:/foo/bar
|
||||||
@@ -47,7 +47,11 @@ export function registerSwapperFileProtocol(ses: Session): void {
|
|||||||
} else {
|
} else {
|
||||||
filePath = url.pathname;
|
filePath = url.pathname;
|
||||||
}
|
}
|
||||||
return net.fetch(`file://${filePath}`);
|
try {
|
||||||
|
return await net.fetch(`file://${filePath}`);
|
||||||
|
} catch {
|
||||||
|
return new Response('Not found', { status: 404 });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user