Fix typerestriction

This is the XP 6 equivalent of xp-framework/xp-framework#355:

*Plain PHP exceptions should not be let thrown by any API - this change should make it easier to track errors occurring when fetching a restriction that was not actually loaded or is unloadable (because no such class does exist).*