Implement special handling of exceptions during REST handler construction
See xp-framework/xp-framework#345