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

Decide what to do with print_error() + lang strings on moodle_exception

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Minor Minor
    • None
    • 3.10
    • Policy
    • None

      Policy: print_error() deprecation and lang strings use in moodle_exception cleanup

      Since 5th Mar 2021, these points have been agreed:

      • print_error() is deprecated. Will be removed in the future (standard deprecation process unless re-analysing it makes it to stay longer).
      • lang strings in moodle_exception will be only translated when they are meant to be shown to final users.

      This issue is about to decide if we want to do something with the print_error() function.

      Rationale:

      • It's a simple wrapper over moodle_exception, with zero added value.
      • There are right now, 913 places where we are already throwing the exception without using it, specially new code (vs 1563 using print_error()).
      • People keeps asking.

      Alternatives:

      A) Do nothing. print_error() is awesome.

      B) In the coding style, recommend to throw new moodle_exception and do the same within code-checker. Keeping the function as is.

      C) Same than B) plus deprecate the print_error(), without debugging. Will stay deprecated forever.

      D) Same than C) plus deprecate it with debugging. Will stay forever. This implies all core cases must be changed (not the hardest replacement in the world).

      E) Same than D) plus removing it at some point. This will break non-updated plugins.

      Bonus (lang strings on moodle_exception).

      In any case, and apart from the alternatives above, we should also clarify when to use (or no) translated strings when throwing moodle exceptions. Note this is exclusively about moodle exceptions and never about any type of coding / database... exceptions.

      The trend seems to be something like: "If the moodle_exception is going to be shown to a final user, translated. Else, hardcoded English literal string"

      Let's discuss a little bit about the 2 points and prepare a voting once them are clear enough.

            Votes:
            0 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved:

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