genenetwork / genenetwork2

GeneNetwork (2nd generation)
http://gn2.genenetwork.org/
GNU Affero General Public License v3.0
34 stars 24 forks source link

fix: cleaner handling for gsearch errors #851

Closed jnduli closed 3 weeks ago

jnduli commented 3 weeks ago

Description

Corresponding gn3 changes for this: https://github.com/genenetwork/genenetwork3/pull/176

When a search has a parser error e.g. https://cd.genenetwork.org/gsearch?type=gene&terms=wiki%3Anicotine+rif%3Amitochondrial+mean%3A12%3A103..12.105 , the error reported on the page is cryptic and doesn't help the end user

    GeneNetwork 2.11-rc2 
    'str' object has no attribute 'items' (error)

Solution

Xapian provides a user readable and understandable error message https://xapian.org/docs/bindings/perl/Xapian/Error.html#get_msg which we display to the end_user

e.g.

    GeneNetwork 2.11-rc2 
    Query `wiki:nicotine rif:mitochondrial mean:12:103..12.105` has a problem: {'error': 'Unknown range operation', 'error_type': "b'QueryParserError'"} (error)

and here's a screenshot

image