How to interrupt the script running back to the Blender?

Hi

I try to find a way to interrupt the export script running in certain error case. The target is just to give a error message to the user and stop the script back to the blender.

So far I only found a ‘exit(0)’ command but this will stop the blender running too…

Thanks