More helpful error message when trying to import by folder from non-github

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2021-07-02 16:18:42 +02:00
parent 82b6d84cf3
commit 43a4ef6442
6 changed files with 52 additions and 41 deletions
+6 -2
View File
@@ -44,8 +44,12 @@ export function basicIntegrations<T extends ScmIntegration>(
return integrations;
},
byUrl(url: string | URL): T | undefined {
const parsed = typeof url === 'string' ? new URL(url) : url;
return integrations.find(i => getHost(i) === parsed.hostname);
try {
const parsed = typeof url === 'string' ? new URL(url) : url;
return integrations.find(i => getHost(i) === parsed.hostname);
} catch {
return undefined;
}
},
byHost(host: string): T | undefined {
return integrations.find(i => getHost(i) === host);