feat: added a catch and override error message for ping check

This commit is contained in:
Akhil Mohan
2024-05-03 18:18:57 +05:30
parent a331eb8dc4
commit fdda247120
@@ -140,7 +140,8 @@ export const auditLogStreamServiceFactory = ({
streamHeaders[key] = value; streamHeaders[key] = value;
}); });
await request.post( await request
.post(
url || logStream.url, url || logStream.url,
{ ping: "ok" }, { ping: "ok" },
{ {
@@ -150,7 +151,10 @@ export const auditLogStreamServiceFactory = ({
// connection timeout // connection timeout
signal: AbortSignal.timeout(AUDIT_LOG_STREAM_TIMEOUT) signal: AbortSignal.timeout(AUDIT_LOG_STREAM_TIMEOUT)
} }
); )
.catch((err) => {
throw new Error(`Failed to connect with the source ${(err as Error)?.message}`);
});
const encryptedHeaders = headers ? infisicalSymmetricEncypt(JSON.stringify(headers)) : undefined; const encryptedHeaders = headers ? infisicalSymmetricEncypt(JSON.stringify(headers)) : undefined;
const updatedLogStream = await auditLogStreamDAL.updateById(id, { const updatedLogStream = await auditLogStreamDAL.updateById(id, {