Uploaded image for project: 'Nuxeo Elements'
  1. Nuxeo Elements
  2. ELEMENTS-922

Do not throw an exception if an invalid item is detected in selectivity.js

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.4.0
    • Fix Version/s: None
    • Component/s: Selectivity
    • Tags:
    • Backlog priority:
      650

      Description

      selectivity.js contains this function which throws an error if a non valid item is found

      Selectivity.processItem = function(item) {
          if (Selectivity.isValidId(item)) {
              return { id: item, text: '' + item };
          } else if (item && (Selectivity.isValidId(item.id) || item.children) && isString(item.text)) {
              if (item.children) {
                  item.children = Selectivity.processItems(item.children);
              }        return item;
          } else {
              throw new Error('invalid item');
          }
      };
      

      It may happen that an invalid item is returned as an ES aggregate bucket and in this case, the element should be robust not to crash the entire application.

      Would it be possible to ignore the invalid item and only log an error in the console? Or find another solution?

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: