Currently all instances of ILocalizedException interface have to return a Message object from getMessageObject(), which makes them impossible to construct without using global state, cause Message object can not be constructed without global state.
The following needs to be done:
- ILocalizedException::getMessageValue(): MessageValue should be introduced.
- ILocalizedException::getMessageObject() should be deprecated and removed.
This requires a backwards-incompatible change, since we can't introduce new methods to an interface without breaking compatibility, but luckily only 3 extensions implement the interface directly. Introducing a whole new hierarchy of exceptions instead will not be worth it in my opinion.