In instances such as Search API Solr not being able to connect to the backend, any Exceptions that are thrown during the search execution are not handled by Search API pages causing a fatal error on the search results page. My opinion is that exceptions should be handled gracefully, and a friendly error message should be displayed to the user as opposed to throwing a hard 500.

CommentFileSizeAuthor
#1 1617982--catch-exception-1.patch976 bytesdrunken monkey

Comments

drunken monkey’s picture

Status: Active » Needs review
StatusFileSize
new976 bytes

See #1253320: Improve error handling, this is definitely planned, and rather important, for the Search API. I agree that we don't handle this very well at the moment.
In principle, we need clear guidelines on where exceptions should be caught, but I agree that they shouldn't reach the user.
And I guess, catching them late before they'd be displayed makes sense.

Attached is a patch for this module, but the effort goes of course across most Search API-related modules. Please tell me if you think this is the right approach.

In any case, thanks very much for getting this rolling again!

cpliakas’s picture

Status: Needs review » Reviewed & tested by the community

Thomas,

Patch looks great for this specific use case.

In principle, we need clear guidelines on where exceptions should be caught

Agreed. Bigger than Search API, it would be great if Drupal in general had guidelines to follow. But I digress.

Thanks,
Chris

drunken monkey’s picture

Great, committed.

Agreed. Bigger than Search API, it would be great if Drupal in general had guidelines to follow. But I digress.

I agree. It's always annoying if there aren't clear standards and modules start doing things their own way (mine in this case wasn't very good – but in general I think exceptions are a pretty good way of error handling, which Drupal should maybe support more).

drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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