Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-70962

Catch early exceptions when loading modal forms

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.11
    • 3.11
    • Forms Library
    • MOODLE_311_STABLE
    • MOODLE_311_STABLE
    • Hide
      1. Install https://github.com/paulholden/moodle-local_modalformexamples (fork of Marina's plugin from MDL-64554 with extra commit to trigger exceptions)

        git clone https://github.com/paulholden/moodle-local_modalformexamples local/modalformexamples
        

      2. Navigate to <WWWROOT>/local/modalformexamples/test2.php
      3. Press Open form
      4. Confirm you see an exception with the message "You don't have permission to access this form."
      5. Confirm there is no error in the browser console
      6. Navigate to <WWWROOT>/local/modalformexamples/test5.php
      7. Press Open form
      8. Confirm you see an exception with the message "Coding error detected, it must be fixed by a programmer: Bad thing."
      9. Confirm there is no error in the browser console
      Show
      Install https://github.com/paulholden/moodle-local_modalformexamples (fork of Marina's plugin from MDL-64554 with extra commit to trigger exceptions) git clone https://github.com/paulholden/moodle-local_modalformexamples local/modalformexamples Navigate to <WWWROOT>/local/modalformexamples/test2.php Press Open form Confirm you see an exception with the message "You don't have permission to access this form." Confirm there is no error in the browser console Navigate to <WWWROOT>/local/modalformexamples/test5.php Press Open form Confirm you see an exception with the message "Coding error detected, it must be fixed by a programmer: Bad thing." Confirm there is no error in the browser console

      Follow on from MDL-64554 - small thing I found while implementing new modal forms

      If an exception is thrown during the getBody() method (either because the form doesn't exist, or it's check_access_for_dynamic_submission() throws an exception) then this is never shown to the user and the modal placeholder is left on the screen:

      Subsequently clicking the X button to close the modal then causes an error in the browser console:

      Uncaught TypeError: b.one(...) is null
          notifyFormSubmitAjax http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:2
          _notify http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:1089
          use http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:1005
          _notify http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:1089
          handleLoader http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:1234
          _use http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:1325
          use http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:1004
          notifyFormSubmitAjax http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:2
          notifyResetFormChanges http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:130
          _notify http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:1089
          use http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:1005
          _notify http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:1089
          handleLoader http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:1234
          _finish http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:8152
          _onSuccess http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:8201
          complete http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:8440
          onSuccess http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:8502
          _finish http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:4944
          _next http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:5141
          _progress http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:5249
          onLoad http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:5041
          _insert http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:5115
          execute http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:4867
          _next http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:4645
          _load http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:4624
          js http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:4409
          _insert http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:8484
          insert http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:8537
          _continue http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:8520
          insert http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:8539
          _use http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:1297
          use http://moodle.internal/master/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple.js:1004
          notifyResetFormChanges http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:130
          notifyResetFormChanges http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:130
          show http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:130
          jQuery 7
          hide http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:5
          jQuery 2
          hide http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:5
          registerEventListeners http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:5
          jQuery 7
          g http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:4
          i http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:4
          jQuery 8
          i http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:4
          define http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:4
          each jQuery
          define http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:4
          registerEventListeners http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:5
          registerEventListeners http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:65
          q http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:5
          k http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:65
          b http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:65
          o http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:37
          e http://moodle.internal/master/lib/requirejs.php/1613994892/core/first.js:37
          jQuery 12
      first.js:2:745
      

        1. 70962-1.png
          70962-1.png
          189 kB
        2. 70962-2.png
          70962-2.png
          235 kB
        3. MDL-70962.jpg
          MDL-70962.jpg
          40 kB

            pholden Paul Holden
            pholden Paul Holden
            Sujith Haridasan Sujith Haridasan
            Andrew Lyons Andrew Lyons
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours, 45 minutes
                4h 45m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.