Catch exceptions correctly in async RPC calls.

Fix a segfault if RPC calls return an error.