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

print_error and error should support throwing exceptions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.0
    • 2.0
    • General
    • None
    • MOODLE_20_STABLE
    • MOODLE_20_STABLE

      Currently, they support throwing exceptions if unit tests are running. It would be great for any code to be able to say, "I want exceptions thrown" instead, either by defining a constant or setting something temporarily in $CFG, eg:

      1.
      define('CONVERTERRORSTOEXCEPTIONS', 1);
      // whatever code that might call error or print_error

      2.
      $CFG->converterrorstoexceptions = true;
      // whatever code that might call error or print_error
      $CFG->converterrorstoexcetions = false;

      3.
      $tmpsetting = $CFG->converterrorstoexceptions;
      $CFG->converterrorstoexceptions = true;
      // whatever code that might call error or print_error
      $CFG->converterrorstoexceptions = $tmpsetting;

      I prefer 3.

            skodak Petr Skoda
            mjollnir Penny Leach (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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