mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 17:27:16 +00:00
Fix returning errors
This commit is contained in:
@@ -521,7 +521,7 @@ export const pkiAcmeServiceFactory = ({
|
|||||||
const { csr } = payload;
|
const { csr } = payload;
|
||||||
// TODO: validate the CSR and return badCSR error if it's invalid
|
// TODO: validate the CSR and return badCSR error if it's invalid
|
||||||
// TODO: this should be the same transaction?
|
// TODO: this should be the same transaction?
|
||||||
let error: Error | undefined;
|
let errorToReturn: Error | undefined;
|
||||||
try {
|
try {
|
||||||
const { certificate, certificateChain, certificateId } =
|
const { certificate, certificateChain, certificateId } =
|
||||||
await certificateV3Service.signCertificateFromProfile({
|
await certificateV3Service.signCertificateFromProfile({
|
||||||
@@ -563,14 +563,14 @@ export const pkiAcmeServiceFactory = ({
|
|||||||
// TODO: log the error
|
// TODO: log the error
|
||||||
// TODO: audit log the error
|
// TODO: audit log the error
|
||||||
if (error instanceof BadRequestError) {
|
if (error instanceof BadRequestError) {
|
||||||
error = new AcmeBadCSRError({ detail: `Invalid CSR: ${error.message}` });
|
errorToReturn = new AcmeBadCSRError({ detail: `Invalid CSR: ${error.message}` });
|
||||||
} else {
|
} else {
|
||||||
error = new AcmeServerInternalError({ detail: "Failed to sign certificate" });
|
errorToReturn = new AcmeServerInternalError({ detail: "Failed to sign certificate with internal error" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
order: (await acmeOrderDAL.findByAccountAndOrderIdWithAuthorizations(accountId, orderId, tx))!,
|
order: (await acmeOrderDAL.findByAccountAndOrderIdWithAuthorizations(accountId, orderId, tx))!,
|
||||||
error
|
error: errorToReturn
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user