Catch error in client.

With out this change in case of error, uncaught exception is thrown.