Is there a way to catch an exception thrown by another program?

Thx.