Affects Version/s: 3.10
Fix Version/s: None
This issue is about to decide if we want to do something with the print_error() function.
- 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.
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.
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.