mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 01:56:27 +08:00
feat: improve electron sandbox (#14156)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user