Added extra error checking to the refresh endpoint call

This commit is contained in:
Matt Aitken
2023-06-30 07:35:46 +01:00
parent 41261afcc4
commit 52cdfb98a4
+13 -9
View File
@@ -151,18 +151,22 @@ async function refreshEndpoint(
endpointId: string,
tunnelUrl: string
) {
const response = await apiClient.registerEndpoint({
id: endpointId,
url: `${tunnelUrl}/api/trigger`,
});
try {
const response = await apiClient.registerEndpoint({
id: endpointId,
url: `${tunnelUrl}/api/trigger`,
});
if (!response.ok) {
logger.error(`Endpoint couldn't refresh: ${response.error}`);
// process.exit(1);
if (!response.ok) {
logger.error(`🚨 Endpoint couldn't refresh: ${response.error}`);
return;
}
return response.data;
} catch (e) {
logger.error(`🚨 Endpoint couldn't refresh: ${e}`);
return;
}
return response.data;
}
//wait function