From 833bdba510ec50df77d9b8f55babbe31626ca53e Mon Sep 17 00:00:00 2001 From: dsinghvi Date: Tue, 29 Oct 2024 21:12:52 -0400 Subject: [PATCH] fix(fdr): dont fail hard on bad server urls --- .../fdr-sdk/src/converters/db/convertAPIDefinitionToDb.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/fdr-sdk/src/converters/db/convertAPIDefinitionToDb.ts b/packages/fdr-sdk/src/converters/db/convertAPIDefinitionToDb.ts index 3b115155fb..342cd7292b 100644 --- a/packages/fdr-sdk/src/converters/db/convertAPIDefinitionToDb.ts +++ b/packages/fdr-sdk/src/converters/db/convertAPIDefinitionToDb.ts @@ -694,7 +694,11 @@ class ApiDefinitionTransformationContext { } private getHost(url: string) { - const parsedBaseUrl = new URL(url); - return parsedBaseUrl.host; + try { + const parsedBaseUrl = new URL(url); + return parsedBaseUrl.host; + } catch (err) { + return ""; + } } }