Correcting misuse of the Error constructor
This commit is contained in:
parent
01d65a327f
commit
f7de56981a
6 changed files with 20 additions and 19 deletions
|
@ -19,8 +19,8 @@ class Instagram extends Ytdlp {
|
|||
const exitCode = await p.exited;
|
||||
if (exitCode != 0) {
|
||||
this.status = "INACTIVE";
|
||||
const err = new Error(await new Response(p.stderr).text());
|
||||
throw err;
|
||||
const stderr = await new Response(p.stderr).text();
|
||||
throw stderr;
|
||||
}
|
||||
const path = await new Response(p.stdout).text();
|
||||
this.filePath = sanitizePath(path);
|
||||
|
|
|
@ -29,8 +29,8 @@ class Pinterest extends Ytdlp {
|
|||
const exitCode = await p.exited;
|
||||
if (exitCode != 0) {
|
||||
this.status = "INACTIVE";
|
||||
const err = new Error(await new Response(p.stderr).text());
|
||||
throw err;
|
||||
const stderr = await new Response(p.stderr).text();
|
||||
throw stderr;
|
||||
}
|
||||
const path = await new Response(p.stdout).text();
|
||||
this.filePath = sanitizePath(path);
|
||||
|
|
|
@ -34,8 +34,8 @@ class SoundCloud extends Ytdlp {
|
|||
const exitCode = await p.exited;
|
||||
if (exitCode != 0) {
|
||||
this.status = "INACTIVE";
|
||||
const err = new Error(await new Response(p.stderr).text());
|
||||
throw err;
|
||||
const stderr = await new Response(p.stderr).text();
|
||||
throw stderr;
|
||||
}
|
||||
const path = await new Response(p.stdout).text();
|
||||
this.filePath = sanitizePath(path);
|
||||
|
|
|
@ -19,8 +19,8 @@ class Tiktok extends Ytdlp {
|
|||
const exitCode = await p.exited;
|
||||
if (exitCode != 0) {
|
||||
this.status = "INACTIVE";
|
||||
const err = new Error(await new Response(p.stderr).text());
|
||||
throw err;
|
||||
const stderr = await new Response(p.stderr).text();
|
||||
throw stderr;
|
||||
}
|
||||
const path = await new Response(p.stdout).text();
|
||||
this.filePath = sanitizePath(path);
|
||||
|
|
|
@ -34,8 +34,8 @@ class YTMusic extends Ytdlp {
|
|||
const exitCode = await p.exited;
|
||||
if (exitCode != 0) {
|
||||
this.status = "INACTIVE";
|
||||
const err = new Error(await new Response(p.stderr).text());
|
||||
throw err;
|
||||
const stderr = await new Response(p.stderr).text();
|
||||
throw stderr;
|
||||
}
|
||||
const path = await new Response(p.stdout).text();
|
||||
this.filePath = sanitizePath(path);
|
||||
|
|
|
@ -12,12 +12,13 @@ class Youtube extends Ytdlp {
|
|||
stdout: "pipe",
|
||||
stderr: "pipe",
|
||||
});
|
||||
let pOut: string = "";
|
||||
try {
|
||||
pOut = await new Response(p.stdout).text();
|
||||
} catch (error) {
|
||||
throw error;
|
||||
const exitCode = await p.exited;
|
||||
if (exitCode != 0) {
|
||||
this.status = "INACTIVE";
|
||||
const stderr = await new Response(p.stderr).text();
|
||||
throw stderr;
|
||||
}
|
||||
const pOut = await new Response(p.stdout).text();
|
||||
const lines = pOut.trim().split("\n");
|
||||
const qualitys = new Map<string, YTVideoInfo>();
|
||||
for (const line of lines) {
|
||||
|
@ -77,8 +78,8 @@ class Youtube extends Ytdlp {
|
|||
const exitCode = await p.exited;
|
||||
if (exitCode != 0) {
|
||||
this.status = "INACTIVE";
|
||||
const err = new Error(await new Response(p.stderr).text());
|
||||
throw err;
|
||||
const stderr = await new Response(p.stderr).text();
|
||||
throw stderr;
|
||||
}
|
||||
const path = await new Response(p.stdout).text();
|
||||
this.filePath = sanitizePath(path);
|
||||
|
@ -113,8 +114,8 @@ class Youtube extends Ytdlp {
|
|||
const exitCode = await p.exited;
|
||||
if (exitCode != 0) {
|
||||
this.status = "INACTIVE";
|
||||
const err = new Error(await new Response(p.stderr).text());
|
||||
throw err;
|
||||
const stderr = await new Response(p.stderr).text();
|
||||
throw stderr;
|
||||
}
|
||||
const path = await new Response(p.stdout).text();
|
||||
this.filePath = sanitizePath(path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue