Skip to content

Commit 429e24f

Browse files
committed
prevent error logs on each keystroke if user is typing url
Signed-off-by: Stephen Rugh <rugh@adobe.com>
1 parent 868767a commit 429e24f

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

tools/site-creator/site-creator.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,18 @@ class SiteCreator extends LitElement {
3131
const value = input.value.toLowerCase();
3232
input.value = value; // Update the input field with lowercase value
3333

34-
const url = new URL(value);
35-
const org = url.pathname.split('/')[1];
36-
const repo = url.pathname.split('/')[2];
34+
try {
35+
const url = new URL(value);
36+
const org = url.pathname.split('/')[1];
37+
const repo = url.pathname.split('/')[2];
3738

38-
if (org && repo && url.hostname === 'github.com') {
39-
this._status = null;
40-
this._data = { org, repo };
39+
if (org && repo && url.hostname === 'github.com') {
40+
this._status = null;
41+
this._data = { org, repo };
42+
}
43+
} catch (error) {
44+
// We don't care about form change errors so long as the value is a url
45+
// upon form submission.
4146
}
4247
}
4348

0 commit comments

Comments
 (0)