feat: improve electron sandbox (#14156)

This commit is contained in:
DarkSky
2025-12-27 03:23:28 +08:00
committed by GitHub
parent 3fe8923fc3
commit 4eed92cebf
32 changed files with 570 additions and 213 deletions
@@ -63,13 +63,22 @@ export class FetchService extends Service {
}
);
} catch (err: any) {
const isAbort =
err?.name === 'AbortError' ||
err?.code === 'ABORT_ERR' ||
err?.type === 'aborted' ||
abortController.signal.aborted;
const message =
err?.message || (isAbort ? 'Request aborted' : 'Unknown network error');
throw new UserFriendlyError({
status: 504,
code: 'NETWORK_ERROR',
type: 'NETWORK_ERROR',
name: 'NETWORK_ERROR',
message: `Network error: ${err.message}`,
stacktrace: err.stack,
status: isAbort ? 499 : 504,
code: isAbort ? 'REQUEST_ABORTED' : 'NETWORK_ERROR',
type: isAbort ? 'REQUEST_ABORTED' : 'NETWORK_ERROR',
name: isAbort ? 'REQUEST_ABORTED' : 'NETWORK_ERROR',
message: `Network error: ${message}`,
stacktrace: err?.stack,
});
} finally {
clearTimeout(timeoutId);