Hi,
If you want to raise a custom exception in mapping use the below udf.
Ex:id -->mapwithdefault-->udf-->id
if(!id.equals("")){return id;}
else{throw new StreamTransformationException("Source field \"id\" value is empty");}
As above said in your example it didn't throw default error because you are passing empty value(tag without any value).
It will throw error when you pass null value i.e (without tag )
Regards
Venkat