feat: Add youtube-dl exit code to the exceptions
This commit is contained in:
parent
5a527373bd
commit
b27fa518c9
1 changed files with 4 additions and 3 deletions
|
@ -110,12 +110,13 @@ class VideoDownload
|
||||||
$process->run();
|
$process->run();
|
||||||
if (!$process->isSuccessful()) {
|
if (!$process->isSuccessful()) {
|
||||||
$errorOutput = trim($process->getErrorOutput());
|
$errorOutput = trim($process->getErrorOutput());
|
||||||
|
$exitCode = $process->getExitCode();
|
||||||
if ($errorOutput == 'ERROR: This video is protected by a password, use the --video-password option') {
|
if ($errorOutput == 'ERROR: This video is protected by a password, use the --video-password option') {
|
||||||
throw new PasswordException($errorOutput);
|
throw new PasswordException($errorOutput, $exitCode);
|
||||||
} elseif (substr($errorOutput, 0, 21) == 'ERROR: Wrong password') {
|
} elseif (substr($errorOutput, 0, 21) == 'ERROR: Wrong password') {
|
||||||
throw new Exception(_('Wrong password'));
|
throw new Exception(_('Wrong password'), $exitCode);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception($errorOutput);
|
throw new Exception($errorOutput, $exitCode);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return trim($process->getOutput());
|
return trim($process->getOutput());
|
||||||
|
|
Loading…
Reference in a new issue