mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-01-17 15:19:50 -06:00
remove unnecessary try/catch
This commit is contained in:
@@ -13,18 +13,14 @@ const handleError = (error, serviceName, method, status = 500) => {
|
||||
};
|
||||
|
||||
const fetchMonitorCertificate = async (sslChecker, monitor) => {
|
||||
try {
|
||||
const monitorUrl = new URL(monitor.url);
|
||||
const hostname = monitorUrl.hostname;
|
||||
const cert = await sslChecker(hostname);
|
||||
// Throw an error if no cert or if cert.validTo is not present
|
||||
if (cert?.validTo === null || cert?.validTo === undefined) {
|
||||
throw new Error("Certificate not found");
|
||||
}
|
||||
return cert;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
const monitorUrl = new URL(monitor.url);
|
||||
const hostname = monitorUrl.hostname;
|
||||
const cert = await sslChecker(hostname);
|
||||
// Throw an error if no cert or if cert.validTo is not present
|
||||
if (cert?.validTo === null || cert?.validTo === undefined) {
|
||||
throw new Error("Certificate not found");
|
||||
}
|
||||
return cert;
|
||||
};
|
||||
|
||||
export { handleValidationError, handleError, fetchMonitorCertificate };
|
||||
|
||||
Reference in New Issue
Block a user