FetcherResult::checkFile() throws \RuntimeException, which is never caught

Created on 12 July 2020, about 4 years ago
Updated 22 June 2024, 3 months ago

This issue is really another symptom of 📌 Missing temporary files in load balanced environments Fixed . When the parser is unable to access the fetched file, FetcherResult::checkFile() throws a RuntimeException. But also ties into #3155929: Http Fetcher receiving 304s Do not clear out their queue items. where this is also a way thrown exceptions aren't caught, leaving un-processable items in the Queue.

At this moment, I am seeing this happen via the feeds_ex module's XMLParser (TODO verify). But I assume this might be an issue for any Parser. The uncaught exception is problematic, because it prevents queue items from being removed from the queue. This can get really problematic due to

Do the RSS, or other parsers, catch these exceptions? Where/how should RuntimeException be caught?
FeedsExecutable::handleException() uses:

    if ($exception instanceof \RuntimeException) {
      $this->messenger->addError($exception->getMessage());
      return;
    }

(should be "\RuntimeException")

But FeedsQueueExecutable::handleException() does not handle RuntimeException in this same way. It just checks for an EmptyFeedException and returns. I'm not sure on the rationale for using RuntimeException here over anything else. Maybe it makes sense to throw a core FileNotFoundException and catch that instead?

Edit: I think it's more accurate to say that the Exception is caught, but is then re-thrown, and never caught.

Edit 2: for comparison, CSVParser throws an InvalidArgumentException. And this may actuallybelong more in feeds_ex, since it's in ParserBase::parse() where he exception is thrown, caught, and th-thrown (the first time).

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇺🇸United States bburg Washington D.C.

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024