public static RPCException Read(Serializer iprot) { Field field; string message = null; ExceptionType type = ExceptionType.Unknown; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.String) { message = iprot.ReadString(); } else { ProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.I32) { type = (ExceptionType)iprot.ReadI32(); } else { ProtocolUtil.Skip(iprot, field.Type); } break; default: ProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); return new RPCException(type, message); }