Problem/Motivation

When #3502161: Drupal.org JSON API modules endpoint returns a 400 error when requested by the Project browser we could see that there was an error with the query. It is great that we could see that there was an error, but the front-end user doesn't probably need to have that much information in the front-end.

Error message

Steps to reproduce

Locally, you can go to src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php and change this line:
'include' => 'field_module_categories,field_maintenance_status,field_development_status,uid,field_project_images',

to be
'include' => 'field_module_categories,field_maintenance_status,field_development_status,uid,field_project_images,another_non_existent_field',

Then clear the storage and query the front-end again.

Proposed resolution

Only display that there was an error in the front-end and log the full error via the logger service (watchdog or similar).
new message

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

fjgarlin created an issue. See original summary.

fjgarlin’s picture

Issue summary: View changes
StatusFileSize
new204.78 KB

fjgarlin’s picture

Status: Active » Needs review

This will show up a generic short message to the front-end while still logging the full message via the logger service.
Ready for review.

fjgarlin’s picture

Title: Reduce amount of information relayed on error to the front-end » Reduce the amount of information relayed on error by the DrupalOrgJsonApi plugin to the front-end
fjgarlin’s picture

Issue summary: View changes
StatusFileSize
new41.06 KB

Proposed message:
new message

phenaproxima’s picture

I think this is a great idea.

I would maybe rephrase the error, though. How about something like:

An error occurred while fetching data from drupal.org. See the error log for details, or report the issue. While this error persists, you can browse the project catalog on drupal.org.

fjgarlin’s picture

Suggestion from #7 about the text applied, except that I didn't offer a link in the words "error log" and that the link to report an issue is against the "drupalorg" project. We can triage the issue from there and move back to PB queue if needed (also, PB might be merged into core at some point so the link would need to change).

fjgarlin’s picture

phenaproxima’s picture

Status: Needs review » Needs work

One further suggestion but otherwise I'm fine with your changes.

fjgarlin’s picture

Status: Needs work » Needs review

Suggestion applied.

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

Not sure how to manually test this, but I think that this is a much better user experience which doesn't compromise debuggability, since it logs the original error.

fjgarlin’s picture

Easy to test manually via Drupalpod. See the change that I cleaned up in this commit: https://git.drupalcode.org/project/project_browser/-/merge_requests/685/...

If you add that bit, you can see the error message. Just don't commit it (like I did 🙈).

chrisfromredfin made their first commit to this issue’s fork.

chrisfromredfin’s picture

Status: Reviewed & tested by the community » Fixed

Clean up error messages, always a better UX.

fjgarlin’s picture

Status: Fixed » Needs review
phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

Fine with that.

phenaproxima’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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