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

print_error and error should support throwing exceptions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: General
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      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

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

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                24/Nov/10