Throw more descriptive errors

This commit is contained in:
2026-03-14 22:15:12 +01:00
parent 71a8d05666
commit e5bf3b1aed

View File

@@ -320,7 +320,7 @@ export class Contacts {
const hash = parseNodeHash(channelHash) as number;
const groups = this.groups[hash] || [];
if (groups.length === 0) {
throw new Error("Unknown group hash");
throw new Error(`Unknown group hash ${hash.toString(16).padStart(2, "0")}`);
}
for (const group of groups) {
try {
@@ -330,7 +330,7 @@ export class Contacts {
// Ignore decryption errors and try the next group.
}
}
throw new Error("Decryption failed with all known groups");
throw new Error(`Decryption failed with all known groups with hash ${hash.toString(16).padStart(2, "0")}`);
}
public decryptGroupData(
@@ -344,7 +344,7 @@ export class Contacts {
const hash = parseNodeHash(channelHash) as number;
const groups = this.groups[hash] || [];
if (groups.length === 0) {
throw new Error("Unknown group hash");
throw new Error(`Unknown group hash ${hash.toString(16).padStart(2, "0")}`);
}
for (const group of groups) {
try {
@@ -354,6 +354,6 @@ export class Contacts {
// Ignore decryption errors and try the next group.
}
}
throw new Error("Decryption failed with all known groups");
throw new Error(`Decryption failed with all known groups with hash ${hash.toString(16).padStart(2, "0")}`);
}
}