feat: changes based on reviews

This commit is contained in:
=
2025-02-26 20:45:40 +05:30
parent 44f74e4d12
commit d84bac5fba
6 changed files with 55 additions and 39 deletions
+7 -1
View File
@@ -105,7 +105,10 @@ export const pingGatewayAndVerify = async ({
}
}
throw new Error(`Failed to ping gateway after ${maxRetries} attempts. Last error: ${lastError?.message}`);
logger.error(lastError);
throw new BadRequestError({
message: `Failed to ping gateway after ${maxRetries} attempts. Last error: ${lastError?.message}`
});
};
interface TProxyServer {
@@ -251,6 +254,9 @@ export const withGatewayProxy = async (
try {
// Execute the callback with the allocated port
await callback(port);
} catch (err) {
logger.error(err, "Failed to proxy");
throw new BadRequestError({ message: (err as Error)?.message });
} finally {
// Ensure cleanup happens regardless of success or failure
cleanup();