@@ -37,7 +37,7 @@ protected virtual SubscrieDelegate GetCallbackFromData(NetDataReader reader)
3737 SubscrieDelegate action ;
3838 if ( ! _callbacks . TryGetValue ( hash , out action ) )
3939 {
40- throw new Exception ( "Undefined packet in NetDataReader" ) ;
40+ throw new ParseException ( "Undefined packet in NetDataReader" ) ;
4141 }
4242 return action ;
4343 }
@@ -95,6 +95,7 @@ public void ReadAllPackets(NetDataReader reader)
9595 /// </summary>
9696 /// <param name="reader">NetDataReader with packets data</param>
9797 /// <param name="userData">Argument that passed to OnReceivedEvent</param>
98+ /// <exception cref="ParseException">Malformed packet</exception>
9899 public void ReadAllPackets ( NetDataReader reader , object userData )
99100 {
100101 while ( reader . AvailableBytes > 0 )
@@ -107,6 +108,7 @@ public void ReadAllPackets(NetDataReader reader, object userData)
107108 /// Reads one packet from NetDataReader and calls OnReceive delegate
108109 /// </summary>
109110 /// <param name="reader">NetDataReader with packet</param>
111+ /// <exception cref="ParseException">Malformed packet</exception>
110112 public void ReadPacket ( NetDataReader reader )
111113 {
112114 ReadPacket ( reader , null ) ;
@@ -173,6 +175,7 @@ public byte[] WriteNetSerializable<T>(T packet) where T : INetSerializable
173175 /// </summary>
174176 /// <param name="reader">NetDataReader with packet</param>
175177 /// <param name="userData">Argument that passed to OnReceivedEvent</param>
178+ /// <exception cref="ParseException">Malformed packet</exception>
176179 public void ReadPacket ( NetDataReader reader , object userData )
177180 {
178181 GetCallbackFromData ( reader ) ( reader , userData ) ;
@@ -183,6 +186,7 @@ public void ReadPacket(NetDataReader reader, object userData)
183186 /// </summary>
184187 /// <param name="onReceive">event that will be called when packet deserialized with ReadPacket method</param>
185188 /// <param name="packetConstructor">Method that constructs packet intead of slow Activator.CreateInstance</param>
189+ /// <exception cref="InvalidTypeException"><typeparamref name="T"/>'s fields are not supported, or it has no fields</exception>
186190 public void Subscribe < T > ( Action < T > onReceive , Func < T > packetConstructor ) where T : class , new ( )
187191 {
188192 _netSerializer . Register < T > ( ) ;
@@ -199,6 +203,7 @@ public void ReadPacket(NetDataReader reader, object userData)
199203 /// </summary>
200204 /// <param name="onReceive">event that will be called when packet deserialized with ReadPacket method</param>
201205 /// <param name="packetConstructor">Method that constructs packet intead of slow Activator.CreateInstance</param>
206+ /// <exception cref="InvalidTypeException"><typeparamref name="T"/>'s fields are not supported, or it has no fields</exception>
202207 public void Subscribe < T , TUserData > ( Action < T , TUserData > onReceive , Func < T > packetConstructor ) where T : class , new ( )
203208 {
204209 _netSerializer . Register < T > ( ) ;
@@ -215,6 +220,7 @@ public void ReadPacket(NetDataReader reader, object userData)
215220 /// This metod will overwrite last received packet class on receive (less garbage)
216221 /// </summary>
217222 /// <param name="onReceive">event that will be called when packet deserialized with ReadPacket method</param>
223+ /// <exception cref="InvalidTypeException"><typeparamref name="T"/>'s fields are not supported, or it has no fields</exception>
218224 public void SubscribeReusable < T > ( Action < T > onReceive ) where T : class , new ( )
219225 {
220226 _netSerializer . Register < T > ( ) ;
@@ -231,6 +237,7 @@ public void ReadPacket(NetDataReader reader, object userData)
231237 /// This metod will overwrite last received packet class on receive (less garbage)
232238 /// </summary>
233239 /// <param name="onReceive">event that will be called when packet deserialized with ReadPacket method</param>
240+ /// <exception cref="InvalidTypeException"><typeparamref name="T"/>'s fields are not supported, or it has no fields</exception>
234241 public void SubscribeReusable < T , TUserData > ( Action < T , TUserData > onReceive ) where T : class , new ( )
235242 {
236243 _netSerializer . Register < T > ( ) ;
0 commit comments