fix: report the actual error on youtube-dl returned an empty object (#55)

This commit is contained in:
Jelle Glebbeek
2021-05-18 16:27:52 +02:00
parent cc8c1a75da
commit 6afb09952d
3 changed files with 4 additions and 3 deletions

View File

@@ -47,7 +47,7 @@ class QueryManager {
this.environment.errorHandler.raiseError({code: "Not supported", description: "Livestreams are not yet supported."}, metadataVideo.identifier);
break;
default:
this.environment.errorHandler.raiseUnhandledError("Youtube-dl returned an empty object\n" + JSON.stringify(Utils.detectInfoType(initialQuery), null, 2), metadataVideo.identifier);
//this.environment.errorHandler.raiseUnhandledError("Youtube-dl returned an empty object\n" + JSON.stringify(Utils.detectInfoType(initialQuery), null, 2), metadataVideo.identifier);
break;
}
}

View File

@@ -38,7 +38,8 @@ class Query {
const {stdout} = await execa(command, args);
return stdout
} catch(e) {
this.environment.errorHandler.checkError(e.stderr, this.identifier);
console.error(e.stderr);
this.environment.errorHandler.raiseUnhandledError("Please report this error.\n" + e.stderr, this.identifier);
return "{}";
}
} else {

View File

@@ -157,5 +157,5 @@ function execaMockBuilder(killed) {
}
function instanceBuilder(spoofUserAgent, cookiePath, errorHandlerMock, pythonCommand) {
return new Query({pythonCommand: pythonCommand, errorHandler: {checkError: errorHandlerMock}, paths: {ytdl: "a/path/to/ytdl"}, settings: {cookiePath: cookiePath, spoofUserAgent: spoofUserAgent}}, "test__id");
return new Query({pythonCommand: pythonCommand, errorHandler: {checkError: errorHandlerMock, raiseUnhandledError: errorHandlerMock}, paths: {ytdl: "a/path/to/ytdl"}, settings: {cookiePath: cookiePath, spoofUserAgent: spoofUserAgent}}, "test__id");
}