if (res == null) {
final String msg = env != null ? env : "??";
throw new RpcTimeoutException(msg);
}
if (!(res instanceof OtpErlangTuple)) {
throw new RpcException(res.toString());
}
final OtpErlangTuple t = (OtpErlangTuple) res;
if (t.arity() != 2) {
throw new RpcException(res.toString());
}
res = t.elementAt(1);
} catch (final OtpErlangExit e) {
throw new RpcException(e);
} catch (final OtpErlangDecodeException e) {
throw new RpcException(e);
}
return res;
}