Skip to content

Commit f935fdb

Browse files
committed
Catch error on autoDiscovery
Related issue: #192
1 parent d07868b commit f935fdb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/utils/autoDiscovery.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ export default async (url, params = {}, options = {}) => {
88
const html = await getHtml(url, options)
99
const doc = new DOMParser().parseFromString(html, 'text/html')
1010
const elm = doc.querySelector('link[type="application/json+oembed"]')
11+
if (!elm) {
12+
throw new Error('No oEmbed link found')
13+
}
1114
const href = elm.getAttribute('href')
1215
const q = new URL(href)
1316
const { origin, pathname, searchParams } = q

0 commit comments

Comments
 (0)