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

Catch early exceptions when loading modal forms

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.11
    • Fix Version/s: 3.11
    • Component/s: Forms Library
    • Labels:
    • Testing Instructions:
      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
    • Affected Branches:
      MOODLE_311_STABLE
    • Fixed Branches:
      MOODLE_311_STABLE
    • Pull 3.11 Branch:
      MDL-70962-311
    • Pull Master Branch:

      Description

      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
      

        Attachments

        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

          Issue Links

            Activity

              People

              Assignee:
              pholden Paul Holden
              Reporter:
              pholden Paul Holden
              Peer reviewer:
              Sujith Haridasan Sujith Haridasan
              Integrator:
              Andrew Lyons Andrew Lyons
              Tester:
              Anna Carissa Sadia Anna Carissa Sadia
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                17/May/21

                  Time Tracking

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