Rework the error system
There are several problems with the current error system of FusionDirectory:
- The error is passed as a text string with no context (class, line, object, attribute, …)
- The error text may contain HTML, and because of this is not always escaped as it should (see #5907)
The idea is to replace error strings with objects which contain:
- As much context as possible (class, file, line, object dn, object type, attribute concerned if any, … Which context is stored will depend of error types)
- A ready to print error text with HTML tags
- An text-only version of the error, for webservice purposes (should be computed from the other one)
This would allow webservice to have detailed information on an error, especially for check errors, to know which attribute triggers the error. It would avoid the webservice receiving HTML in the error message. It would avoid escaping problems in the UI. When rendering the error in FD, it would allow to give some context if available, in a standardized manner. If debug is active, it will allow to give a trace of the actual error and not of the call to msg_dialog::display like the current situation.
This class should have a __toString method to fallback to string rendering for backward compatibility. This should allow us to have both error objects and error strings for the transition.
Linked ticket
Error dialogs do not escape HTML from fields https://gitlab.fusiondirectory.org/fusiondirectory/fd/-/issues/5907