refactor: improve error handling for gateway connection in LDAP functions

This commit is contained in:
Victor Santos
2025-11-17 09:36:57 -03:00
parent 34d92f9080
commit 84d505bbb0
@@ -124,7 +124,10 @@ export const executeWithPotentialGateway = async <T>(
targetPort: port targetPort: port
}); });
if (platformConnectionDetails) { if (!platformConnectionDetails) {
throw new BadRequestError({ message: "Unable to connect to gateway, no platform connection details found" });
}
return withGatewayV2Proxy( return withGatewayV2Proxy(
async (proxyPort) => { async (proxyPort) => {
const proxyUrl = constructLdapUrl(protocol, "localhost", proxyPort); const proxyUrl = constructLdapUrl(protocol, "localhost", proxyPort);
@@ -161,7 +164,6 @@ export const executeWithPotentialGateway = async <T>(
} }
); );
} }
}
// Non-gateway path - calls getLdapConnectionClient which has validation // Non-gateway path - calls getLdapConnectionClient which has validation
const client = await getLdapConnectionClient(credentials); const client = await getLdapConnectionClient(credentials);