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

Improve DX for exceptions when developing and make it easier to open in editor

XMLWordPrintable

    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE, MOODLE_404_STABLE
    • MOODLE_404_STABLE
    • MDL-79974-master-3
    • Hide
      1. Enable debug developer:

        mdk run dev
        

      2. Ensure that Whoops isn't already installed:

        rm -rf vendor/filp
        

      3. Open lib/templates/drawer.mustache in your preferred editor:
      4. Break the template in some way, for example change the content to:

        {{#foo}}
        

      5. Visit any page in your browser
        1. Confirm you see a Moodle exception page
      6. Install composer dependencies:

        php composer.phar install
        

      7. Refresh the page
        1. Confirm you see a pretty Whoops error page
      8. Open the config.php file in your preferred editor
      9. Add a setting:

        $CFG->debug_developer_use_pretty_exceptions = false;
        

      10. Refresh the page
        1. Confirm you see a Moodle exception page
      11. Disable debug developer:

        mdk run undev
        

        Unset the config.php setting (or change it to true):

        # $CFG->debug_developer_use_pretty_exceptions = false;
        $CFG->debug_developer_use_pretty_exceptions = true;
        

      12. Refresh the page
        1. Confirm you see a Moodle exception page
      Show
      Enable debug developer: mdk run dev Ensure that Whoops isn't already installed: rm -rf vendor/filp Open lib/templates/drawer.mustache in your preferred editor: Break the template in some way, for example change the content to: {{#foo}} Visit any page in your browser Confirm you see a Moodle exception page Install composer dependencies: php composer.phar install Refresh the page Confirm you see a pretty Whoops error page Open the config.php file in your preferred editor Add a setting: $CFG->debug_developer_use_pretty_exceptions = false; Refresh the page Confirm you see a Moodle exception page Disable debug developer: mdk run undev Unset the config.php setting (or change it to true): # $CFG->debug_developer_use_pretty_exceptions = false; $CFG->debug_developer_use_pretty_exceptions = true; Refresh the page Confirm you see a Moodle exception page

      I've been using Whoops on another issue and feel that it would fit well into Moodle.

      It's entirely optional, and we won't bundle it in the release. It only makes sense to enable it:

      • when debug and debugdisplay are set
      • when working on web requests, and not CLI or AJAX

      Therefore we can include it as a developer dependency in the same way that we do for Behat, and PHPUnit via a Composer autoload.

      I've also added a $CFG->debug_developer_use_pretty_exceptions flag to disable it for those who don't like functional UIs for developers (or for those who are working on those exceptions in some way).

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Jun Pataleta Jun Pataleta
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 7 hours, 15 minutes
                7h 15m

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