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

META: Cleanup of harcoded error() messages

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 2.0
    • Component/s: General
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      There are thousands of places in Moodle where we are using the error() function to print out hardcoded strings.

      In the long term, we should end with ZERO calls to this function, by using the print_error() on instead.

      Here it's one plan that could be good to start handling this migration:

      1) Move error() to deprecatelib. Just that. 1.9 and HEAD
      2) Make print_error() autonomous so it won't rely on error() code anymore (will cause code duplication, I guess, but better in the long term.) 1.9 and HEAD
      3) Under HEAD (not under 19_STABLE because it could be the plague!), in the deprecated error() function, add some DEBUG_DEVELOPER debugging() to inform developers. It will cause a lot of output (pain!)
      4) Move all current uses of error(get_string('xxxx')) to a proper use of print_error() 1.9 and HEAD
      5) Gradually, start creating error strings and changing error() calls to print_error() ones. Moodle 2.0 should be free of error() calls. HEAD only.

      This is the overall plan. I think each step above could be a subtask of this. Please review it with MD. I think it could work (although once we do point 3 HEAD will be horrible until we'll have all the error() uses killed).

      Ciao

        Attachments

          Issue Links

          There are no Sub-Tasks for this issue.

            Activity

              People

              Assignee:
              dongsheng Dongsheng Cai
              Reporter:
              stronk7 Eloy Lafuente (stronk7)
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

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