If you look at XenForo_ControllerPublic_Error you'll find a method that's similar to vBulletins print_no_permission: actionNoPermission(), it returns a controller response which would need to be passed back to the main application. The primary XenForo_Controller has the method "responseError" for making custom error responses.