mirror of
https://github.com/LBRYFoundation/Watch-on-LBRY.git
synced 2025-08-23 17:47:26 +00:00
Merge pull request #99 from DeepDoge/master
On error background returns undefined but it should throw
This commit is contained in:
commit
e501a8b828
2 changed files with 4 additions and 2 deletions
|
@ -17,7 +17,7 @@ async function lbryPathnameFromVideoId(videoId: string): Promise<string | void>
|
|||
}
|
||||
|
||||
chrome.runtime.onMessage.addListener(({ videoId }: { videoId: string }, sender, sendResponse) => {
|
||||
lbryPathnameFromVideoId(videoId).then((lbryPathname) => sendResponse(lbryPathname))
|
||||
lbryPathnameFromVideoId(videoId).then((lbryPathname) => sendResponse(lbryPathname)).catch((err) => sendResponse(err))
|
||||
return true
|
||||
})
|
||||
|
||||
|
|
|
@ -100,7 +100,9 @@ async function findVideoElement() {
|
|||
|
||||
// We should get this from background, so the caching works and we don't get errors in the future if yt decides to impliment CORS
|
||||
async function requestLbryPathname(videoId: string) {
|
||||
return await new Promise<string | null>((resolve) => chrome.runtime.sendMessage({ videoId }, resolve))
|
||||
const response = await new Promise<string | null | Error>((resolve) => chrome.runtime.sendMessage({ videoId }, resolve))
|
||||
if (response instanceof Error) throw response
|
||||
return response
|
||||
}
|
||||
|
||||
// Start
|
||||
|
|
Loading…
Add table
Reference in a new issue