Hi Christian,
There are a couple of blogs that you should check to get your goal in the best way:
Michal Krawczyk's blog: http://scn.sap.com/community/pi-and-soa-middleware/blog/2007/04/26/xipi-throwing-generic-exceptions-from-any-type-of-mapping
Alessandro Guarneri's blog: Throwing Smart Exceptions in XI Graphical Mapping
Regards.