Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4852

JS errors swallowed during widget class initialization

XMLWordPrintable

    • None

      Steps to Reproduce

      produce an error during widget initialization (usually happens accidentally)

      jserror.Awidget = zk.$extends(zul.wgt.Span, {
          $define: {
              prop1: _myFunc = function() {
                  console.log("something");
              },
              prop2: _myFunc,
              prop3: myFunc /* forgot '_' */
          }
      }, {});
      

      Current Result

      the console error shows a misleading error message, omitting the real cause

      Expected Result

      also show the root cause why the widget is "Unknown"
      especially the line number where the error happens

      e.g. log or rethrow the error

      catch(error) {
         console.error(error);
      }
      
      or
      
      catch(error) {
         throw error;
      }
      

      also consider failing the package load operation by not calling setLoaded and report a meaningful error message instead
      e.g.

      "failed to load 'mypackage.wpd' check browser console for error details"

      Debug Information

      as of now there's a try without a catch block swallowing the error

      Workaround

      enable stop on uncaught exceptions in dev tools (hard to know when the error indicates nothing)

        1. image-2021-04-08-17-01-47-108.png
          46 kB
          cor3000
        2. image-2021-04-08-17-05-53-849.png
          51 kB
          cor3000
        3. screenshot-1.png
          21 kB
          cor3000

            DevChu DevChu
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: