-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.0] Smart Search: Improving error handling of Indexing #39965
Conversation
I have tested this item ✅ successfully on 8b37e66 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39965. |
Co-authored-by: Quy <quy@nomonkeybiz.com>
OK this just hides the message and doesn't give us any way to actually fix the problem? Like if there are PHP errors - yes we don't want things to silently fail - but we do want to make sure that they are logged so we can fix them properly in the future rather than just silently swallowing them. |
I think George is right. joomla-cms/build/media_source/com_finder/js/indexer.es6.js Lines 162 to 167 in 214119e
Need kind of let response;
try {
response = JSON.parse(data);
} catch (e) {
Joomla.renderMessages(Joomla.ajaxErrorsMessages(xhr, 'parsererror'));
}
handleResponse(response); Need to test |
I tried the try-catch and had all of that ready, but it made everything a lot uglier. The thing is that you need to have access to the output and that is now properly in the browser console. I've used this approach because we have most of the necessary code already in there. We have ob_start() everywhere, but we are missing actually suppressing the output. |
I will prepare another pr, need some time |
There it is #39973, please review 😉 |
They are both valid from my perspective. |
No, I'd like to have both merged, since this one here fixes issues on the PHP side, while #39973 fixes this on JS side of things. |
@@ -264,6 +282,7 @@ public static function sendResponse($data = null) | |||
$response->buffer = ob_get_contents(); | |||
$response->memory = memory_get_usage(true); | |||
} | |||
ob_clean(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like we try to silently hide errors, didn't you try to avoid this?
thanks |
Pull Request for Issue #39717.
Summary of Changes
The indexer in Smart Search currently has situations where errors are returned and instead of gracefully reporting an error, the whole indexing just silently stops and does not proceed. This PR tries to catch all output and notices from finder plugins and return that as properly formatted error. I also removed some unused code.
Testing Instructions
var_dump($item->title)
.Actual result BEFORE applying this Pull Request
The indexing starts, but shortly after it does not progress any further.
Expected result AFTER applying this Pull Request
The indexing starts and shortly after an error message is displayed. The whole response can be found in the browser console.
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed