Problem/Motivation
Right now, we don't handle the difference between "there are no results for your query" and "you have given me an invalid query." If there's a bad query (for example because you have an outdated PB client), it will just appear that you have 0 results.
Steps to reproduce
Using these links, you can get different results.
The API if there are truly 0 results:
https://drupalorg.prod.cluster.drupalsystems.org/jsonapi/index/project_m...
The API returns a 400 if you issue a bad request:
https://drupalorg.prod.cluster.drupalsystems.org/jsonapi/index/project_m...
An example good request:
https://drupalorg.prod.cluster.drupalsystems.org/jsonapi/index/project_m...
Proposed resolution
I THINK this is somewhere around here:
https://git.drupalcode.org/project/project_browser/-/blob/2.0.x/src/Plug... - someone please correct me if I'm wrong.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3494818.patch | 2.89 KB | pfrilling |
Issue fork project_browser-3494818
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
Comment #2
phenaproximaComment #3
pfrillingAttached is a patch that I started. Not entirely sure I'm on the right path. Would love some feedback and/or it can help someone else as a starting point.
Comment #6
fjgarlin commentedIt's defo a good beginning, I made it into an MR so we can continue there, give feedback, etc.
https://git.drupalcode.org/project/project_browser/-/merge_requests/651/...
Comment #7
fjgarlin commentedI simplified a bit some of the cosmetic changes. I haven't tested anything yet so I don't know how close we are to a solution.
Comment #8
fjgarlin commented#3494819: Display warnings/errors from DrupalOrgJsonApi backend is ready for review and introduces a way to send error messages to the front-end which we may or may not use here, but I'd like validation of that approach before continuing here.
Comment #9
fjgarlin commentedAs the related issue was just committed, doing this is very straightforward. Ready to test.
In order to test, we could, in `DrupalDotOrgJsonApi.php`, at line 144, add any of the following:
throw new \Exception("Exception Test", 0);Cannot trigger these two because they need additional params added by the library, but the above should be enough to prove the code here:
throw new RequestException("RequestException Test");throw new GuzzleException("GuzzleException Test");Then this should show into the front-end.
Comment #11
chrisfromredfinWonderful work, y'all. This surfaced a follow-up about "caching" results, which include errors. But that's a bigger can of worms.
Comment #12
fjgarlin commentedThe follow-up is this #3498231: Split results storage in keyValue per plugin instead of global