Browse Source

Fix types

km/decrypt-obj
Bernd Schoolmann 12 hours ago
parent
commit
284c271e7f
No known key found for this signature in database
  1. 9
      libs/common/src/platform/models/domain/domain-base.ts

9
libs/common/src/platform/models/domain/domain-base.ts

@ -87,11 +87,18 @@ export default class Domain { @@ -87,11 +87,18 @@ export default class Domain {
try {
viewModel[prop] = await encryptService.decryptString(domain[prop]!, key);
} catch (e) {
// In case the SDK maps to a non-Error type, this is defensive
const errorMsg =
typeof e === "object" && e !== null && "message" in e
? (e as { message: string }).message
: String(e);
// eslint-disable-next-line no-console
console.error(
`Failed to decrypt property '${String(
prop,
)}' of domain. Context: ${objectContext}. Error: ${"message" in e ? e.message : String(e)}`, // In case the SDK maps to a non-Error type, this is defensive
)}' of domain. Context: ${objectContext}. Error: ${errorMsg}`,
);
viewModel[prop] = DECRYPT_ERROR;
}

Loading…
Cancel
Save