misc: addressed undefined issue

This commit is contained in:
Sheen Capadngan
2025-05-18 00:27:52 +08:00
parent 41b45c212d
commit db8f43385d
@@ -1209,6 +1209,10 @@ export const internalCertificateAuthorityServiceFactory = ({
ca = await certificateAuthorityDAL.findByIdWithAssociatedCa(certificateTemplate.caId); ca = await certificateAuthorityDAL.findByIdWithAssociatedCa(certificateTemplate.caId);
} }
if (!ca) {
throw new NotFoundError({ message: `Internal CA with ID '${caId}' not found` });
}
if (!ca?.internalCa?.id) { if (!ca?.internalCa?.id) {
throw new NotFoundError({ message: `Internal CA with ID '${caId}' not found` }); throw new NotFoundError({ message: `Internal CA with ID '${caId}' not found` });
} }
@@ -1561,6 +1565,10 @@ export const internalCertificateAuthorityServiceFactory = ({
ca = await certificateAuthorityDAL.findByIdWithAssociatedCa(certificateTemplate.caId); ca = await certificateAuthorityDAL.findByIdWithAssociatedCa(certificateTemplate.caId);
} }
if (!ca) {
throw new NotFoundError({ message: `Internal CA with ID '${caId}' not found` });
}
if (!ca?.internalCa?.id) { if (!ca?.internalCa?.id) {
throw new NotFoundError({ message: `Internal CA with ID '${caId}' not found` }); throw new NotFoundError({ message: `Internal CA with ID '${caId}' not found` });
} }