Better errors when guessing feed.

This commit is contained in:
Martin Rotter 2021-03-17 07:07:11 +01:00
parent a96e83fb10
commit 57a67760c4
4 changed files with 11 additions and 2 deletions

View File

@ -30,7 +30,7 @@
<url type="donation">https://martinrotter.github.io/donate/</url>
<content_rating type="oars-1.1" />
<releases>
<release version="3.9.0" date="2021-03-16"/>
<release version="3.9.0" date="2021-03-17"/>
</releases>
<content_rating type="oars-1.0">
<content_attribute id="violence-cartoon">none</content_attribute>

View File

@ -204,6 +204,8 @@ Any errors in your script must be written to **error output**.
Note that you must provide full execution line to your custom script, including interpreter binary path and name and all that must be written in special format `<interpreter>#<argument1>#<argument2>#....`. The `#` character is there to separate interpreter and individual arguments. I had to select some character as separator because simply using space ` ` is not that easy as it might sound, because sometimes space could be a part of an argument sometimes argument separator etc.
Used script must return `0` as process exit code if everything went well, or non-zero exit code if some error happened.
Interpreter must be provided in all cases, arguments do not have to be. For example `bash.exe#` is valid execution line, as well as `bash#-c#cat feed.atom`. Note the difference in interpreter's binary name suffix. Also be very carefully about arguments quoting. Some examples of valid and tested execution lines are:
| Command | Explanation |

View File

@ -78,6 +78,7 @@ StandardFeedDetails::StandardFeedDetails(QWidget* parent) : QWidget(parent) {
m_ui.m_txtSource->textEdit()->setFocus(Qt::FocusReason::TabFocusReason);
// Set feed metadata fetch label.
m_ui.m_lblFetchMetadata->label()->setWordWrap(true);
m_ui.m_lblFetchMetadata->setStatus(WidgetWithStatus::StatusType::Information,
tr("No metadata fetched so far."),
tr("No metadata fetched so far."));

View File

@ -547,7 +547,9 @@ QString StandardFeed::runScriptProcess(const QStringList& cmd_args, const QStrin
process.closeWriteChannel();
}
if (process.waitForFinished(run_timeout) && process.exitStatus() == QProcess::ExitStatus::NormalExit) {
if (process.waitForFinished(run_timeout) &&
process.exitStatus() == QProcess::ExitStatus::NormalExit &&
process.exitCode() == EXIT_SUCCESS) {
auto raw_output = process.readAllStandardOutput();
auto raw_error = process.readAllStandardError();
@ -564,6 +566,10 @@ QString StandardFeed::runScriptProcess(const QStringList& cmd_args, const QStrin
auto raw_error = process.readAllStandardError().simplified();
if (raw_error.isEmpty()) {
raw_error = process.readAllStandardOutput().simplified();
}
switch (process.error()) {
case QProcess::ProcessError::Timedout:
throw ScriptException(ScriptException::Reason::InterpreterTimeout);