add support to clear pending exception