Nicer error reporting for infinite recursion

Change-Id: Idf0adfe70f46c7062ccdc0cbea309f47c5fca89e
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>