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

print_error and error should support throwing exceptions

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0
    • 2.0
    • General
    • None
    • MOODLE_20_STABLE
    • MOODLE_20_STABLE

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              skodak Petr Skoda
              mjollnir Penny Leach
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                24/Nov/10