mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-12 04:26:57 +00:00
fix(properties): harden torrent diagnostics lifecycle
This commit is contained in:
@@ -70,6 +70,23 @@ const PROPERTIES_SNAPSHOT_KEYS = [
|
||||
'torrentVerifyRestoreStatus',
|
||||
] as const satisfies readonly (keyof DownloadItem)[];
|
||||
|
||||
export const isExpectedPropertiesDiagnosticUnavailable = (error: unknown): boolean => {
|
||||
const message = (error instanceof Error ? error.message : String(error)).trim().toLowerCase();
|
||||
if (message.startsWith('torrent lifecycle changed while reading ')) return true;
|
||||
return [
|
||||
'torrent peer diagnostics are unavailable for this lifecycle',
|
||||
'torrent availability is unavailable for this lifecycle',
|
||||
'live torrent file progress is unavailable',
|
||||
'live torrent piece progress is unavailable',
|
||||
'active torrent transfer has no gid',
|
||||
'active torrent transfer has no current gid mapping',
|
||||
'active torrent transfer has a stale control epoch',
|
||||
'active torrent has no gid',
|
||||
'active torrent has no current gid mapping',
|
||||
'active torrent has a stale control epoch',
|
||||
].includes(message);
|
||||
};
|
||||
|
||||
type SafePropertiesFields = Pick<DownloadItem, (typeof PROPERTIES_SNAPSHOT_KEYS)[number]>;
|
||||
|
||||
export type PropertiesSnapshot = SafePropertiesFields & {
|
||||
|
||||
Reference in New Issue
Block a user