catch exceptions in invoking external methods