Replaces expected exceptions with try/catch.

Reviewed by: lsheng