refactor: clean up unused variables and empty blocks in utils

database-migration.ts:
- Remove 3 unused variables (encryptedSize, totalOriginalRows, totalMemoryRows)

lazy-field-encryption.ts:
- Fix 6 empty catch blocks with descriptive comments
- Keep error variables where they are used in logging

tunnel.ts:
- Fix multiple empty catch blocks
- Remove empty else blocks
- Partially fixed (10/21 issues resolved)

Reduced errors from 855 to 833 (22 fixes)
This commit is contained in:
ZacharyZcR
2025-10-05 20:31:34 +08:00
parent 93a74277dc
commit 83610cb077
3 changed files with 24 additions and 21 deletions

View File

@@ -29,7 +29,7 @@ export class LazyFieldEncryption {
return false;
}
return true;
} catch (jsonError) {
} catch {
return true;
}
}
@@ -53,7 +53,7 @@ export class LazyFieldEncryption {
fieldName,
);
return decrypted;
} catch (error) {
} catch {
const legacyFieldName = this.LEGACY_FIELD_NAME_MAP[fieldName];
if (legacyFieldName) {
try {
@@ -64,7 +64,9 @@ export class LazyFieldEncryption {
legacyFieldName,
);
return decrypted;
} catch (legacyError) {}
} catch {
// Ignore legacy format errors
}
}
const sensitiveFields = [
@@ -135,7 +137,7 @@ export class LazyFieldEncryption {
wasPlaintext: false,
wasLegacyEncryption: false,
};
} catch (error) {
} catch {
const legacyFieldName = this.LEGACY_FIELD_NAME_MAP[fieldName];
if (legacyFieldName) {
try {
@@ -156,7 +158,9 @@ export class LazyFieldEncryption {
wasPlaintext: false,
wasLegacyEncryption: true,
};
} catch (legacyError) {}
} catch {
// Ignore legacy format errors
}
}
return {
encrypted: fieldValue,
@@ -243,7 +247,7 @@ export class LazyFieldEncryption {
try {
FieldCrypto.decryptField(fieldValue, userKEK, recordId, fieldName);
return false;
} catch (error) {
} catch {
const legacyFieldName = this.LEGACY_FIELD_NAME_MAP[fieldName];
if (legacyFieldName) {
try {
@@ -254,7 +258,7 @@ export class LazyFieldEncryption {
legacyFieldName,
);
return true;
} catch (legacyError) {
} catch {
return false;
}
}