added some error handling

This commit is contained in:
uh wot 2021-05-26 14:03:01 +02:00
parent 47f2be13e5
commit 3c5905bb4e
Signed by: uhwot
GPG Key ID: CB2454984587B781
2 changed files with 6 additions and 3 deletions

6
dist/worker.js vendored

File diff suppressed because one or more lines are too long

View File

@ -111,6 +111,9 @@ async function track(id, format, access_token, tagging) {
return new Response(null, {status: 302, headers: {'location': result}}) return new Response(null, {status: 302, headers: {'location': result}})
} else { } else {
const track = await fetch(result) const track = await fetch(result)
if (track.status !== 200) {
return new Response("Couldn't get track stream", {status: 403, headers: {'content-type': 'text/plain'}})
}
const id3 = new ID3Writer(Buffer.alloc(0)); const id3 = new ID3Writer(Buffer.alloc(0));
id3.padding = 0 id3.padding = 0