•  
      request #40086 JavaScript error when trying an expert query with default mode
    Infos
    #40086
    Joris MASSON (jmasson)
    2024-10-21 15:11
    2024-10-18 17:12
    41713
    Details
    JavaScript error when trying an expert query with default mode

    As revealed by request #40080, given a cross-tracker search widget that was saved in Expert mode, when I switch it from Expert to Default mode (uncheck the switch), and I select at least one tracker BUT I do not change the query (I leave an expert query with SELECT ...)
    then there is the following JavaScript error in the console, and the widget appears "blocked", it does not show an error feedback but the Search button is disabled.

    cross-tracker-BvKKMYVf.js:1 TypeError: Cannot read properties of undefined (reading 'length')
    

    This happens because we intentionally throw an empty SyntaxError in some cases, which has its line number to zero, which causes a problem in the code trying to show where the syntax error comes from in the query. Instead of "hacking" the SyntaxError, we should use another kind of error message, since we trigger this error outside of a parser, we have no idea how the initial query is written. We should not try to guess, we can instead tell the user that the query is invalid for the specific case we encounter.

    Cross tracker search
    Empty
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Joris MASSON (jmasson)
    Closed
    2024-10-21
    Attachments
    Empty
    References

    Follow-ups

    User avatar
    Joris MASSON (jmasson)2024-10-18 17:15
    • Original Submission
      Something went wrong, the follow up content couldn't be loaded
      Only formatting have been changed, you should switch to markup to see the changes