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,17 +140,21 @@ export const auditLogStreamServiceFactory = ({
streamHeaders[key] = value; streamHeaders[key] = value;
}); });
await request.post( await request
url || logStream.url, .post(
{ ping: "ok" }, url || logStream.url,
{ { ping: "ok" },
headers: streamHeaders, {
// request timeout headers: streamHeaders,
timeout: AUDIT_LOG_STREAM_TIMEOUT, // request timeout
// connection timeout timeout: AUDIT_LOG_STREAM_TIMEOUT,
signal: AbortSignal.timeout(AUDIT_LOG_STREAM_TIMEOUT) // connection 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, {