Skip to content

Beautiful Open-Source Form Builder

Debug getDomain in prod

Julien Nahume41929e4c891
diff --git a/client/lib/utils.js b/client/lib/utils.js
index f5eaf25a0..4a8b72848 100644
--- a/client/lib/utils.js
+++ b/client/lib/utils.js
@@ -60,7 +60,12 @@ export const getHost = function () {
*/
export const getDomain = function (url) {
if (url.includes('localhost')) return 'localhost'
- return (new URL(url)).hostname
+ try {
+ return (new URL(url)).hostname
+ } catch (e) {
+ console.error('Error extracting domai from: ',url,e)
+ return null
+ }
}
/**