Add a feature to display JSON errors

Created on 17 August 2021, over 3 years ago
Updated 8 June 2024, 11 months ago

Problem/Motivation

if the feed fetcher fails, the message is

RuntimeException: File File <em class="placeholder">/tmp/feeds_http_fetcherhNB0UJ</em> does not exist

Which does not show what feed fails.

Steps to reproduce

Create a parser and feed.

Proposed resolution

Catch the error higher up and re-throw.

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

🇦🇺Australia interlated

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

  • Status changed to Needs work about 1 year ago
  • 🇳🇱Netherlands megachriz

    Perhaps this indicates that it would be useful to port the following from the D7 version of Feeds Extensible Parsers:

    Also needs automated tests.

  • Merge request !42Display json errors → (Merged) created by ptmkenny
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 5.7
    last update about 1 year ago
    98 pass, 2 fail
  • Pipeline finished with Failed
    about 1 year ago
    Total: 417s
    #153425
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 5.7
    last update about 1 year ago
    113 pass
  • Pipeline finished with Success
    about 1 year ago
    #153477
  • 🇯🇵Japan ptmkenny

    Ok, I rewrote the patch and updated the existing tests, which already cover this exception. I also updated the invalid JSON test by using a common JSON error (adding an extra comma at the end of a pair) instead of a plaintext string so that the test expectation is more clear.

    The debug feature is interesting, but for this specific issue, I think it makes sense to simply show the bad JSON without asking the user for their preference. When the user is importing JSON, and it fails, they probably always want to know what went wrong.

  • Status changed to Needs review about 1 year ago
  • Status changed to Needs work about 1 year ago
  • 🇳🇱Netherlands megachriz

    There is a PHP variable used in a translatable string. See MR for details.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 5.7
    last update about 1 year ago
    92 pass, 8 fail
  • Pipeline finished with Failed
    about 1 year ago
    Total: 380s
    #154400
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 5.7
    last update about 1 year ago
    113 pass
  • Pipeline finished with Success
    about 1 year ago
    Total: 393s
    #154501
  • Status changed to Needs review about 1 year ago
  • 🇯🇵Japan ptmkenny

    I fixed the exception translation and I removed StringTranslationTrait since translating exceptions was its only use.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 5.7
    last update 11 months ago
    116 pass
  • Pipeline finished with Skipped
    11 months ago
    #181995
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 7.4 & MySQL 5.7
    last update 11 months ago
    116 pass
  • Status changed to Fixed 11 months ago
  • 🇳🇱Netherlands megachriz

    I rebased the code to see if there were any phpcs errors and luckily there aren't.

    I also wondered if instead of displaying the whole JSON, if perhaps the error message could be more specific on where the JSON is wrong, but not sure if there is an easy way to display that. json_last_error_msg() does not give any useful info on a syntax error at least.

    So I merged the code. We could open a follow-up if you have ideas on how the JSON error could perhaps be more specific.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024