ErrorCode.cs 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. namespace ET
  2. {
  3. public static partial class ErrorCode
  4. {
  5. public const int ERR_Success = 0;
  6. // 1-11004 是SocketError请看SocketError定义
  7. //-----------------------------------
  8. // 100000-109999是Core层的错误
  9. // 110000 以上,避免跟SocketError冲突
  10. public const int ERR_MyErrorCode = 110000;
  11. public const int ERR_KcpConnectTimeout = 100205;
  12. public const int ERR_PeerDisconnect = 100208;
  13. public const int ERR_SocketCantSend = 100209;
  14. public const int ERR_SocketError = 100210;
  15. public const int ERR_KcpWaitSendSizeTooLarge = 100211;
  16. public const int ERR_KcpCreateError = 100212;
  17. public const int ERR_SendMessageNotFoundTChannel = 100213;
  18. public const int ERR_TChannelRecvError = 100214;
  19. public const int ERR_MessageSocketParserError = 100215;
  20. public const int ERR_KcpNotFoundChannel = 100216;
  21. public const int ERR_WebsocketSendError = 100217;
  22. public const int ERR_WebsocketPeerReset = 100218;
  23. public const int ERR_WebsocketMessageTooBig = 100219;
  24. public const int ERR_WebsocketRecvError = 100220;
  25. public const int ERR_KcpReadNotSame = 100230;
  26. public const int ERR_KcpSplitError = 100231;
  27. public const int ERR_KcpSplitCountError = 100232;
  28. public const int ERR_ActorLocationSenderTimeout = 110004;
  29. public const int ERR_PacketParserError = 110005;
  30. public const int ERR_KcpChannelAcceptTimeout = 110206;
  31. public const int ERR_KcpRemoteDisconnect = 110207;
  32. public const int ERR_WebsocketError = 110303;
  33. public const int ERR_WebsocketConnectError = 110304;
  34. public const int ERR_RpcFail = 110307;
  35. public const int ERR_ReloadFail = 110308;
  36. public const int ERR_ConnectGateKeyError = 110309;
  37. public const int ERR_SessionSendOrRecvTimeout = 110311;
  38. public const int ERR_OuterSessionRecvInnerMessage = 110312;
  39. public const int ERR_NotFoundActor = 110313;
  40. public const int ERR_ActorTimeout = 110315;
  41. public const int ERR_UnverifiedSessionSendMessage = 110316;
  42. public const int ERR_ActorLocationSenderTimeout2 = 110317;
  43. public const int ERR_ActorLocationSenderTimeout3 = 110318;
  44. public const int ERR_ActorLocationSenderTimeout4 = 110319;
  45. public const int ERR_ActorLocationSenderTimeout5 = 110320;
  46. public const int ERR_KcpRouterTimeout = 110401;
  47. public const int ERR_KcpRouterTooManyPackets = 110402;
  48. public const int ERR_KcpRouterSame = 110402;
  49. //-----------------------------------
  50. // 小于这个Rpc会抛异常,大于这个异常的error需要自己判断处理,也就是说需要处理的错误应该要大于该值
  51. public const int ERR_Exception = 200000;
  52. public const int ERR_Cancel = 200001;
  53. public static bool IsRpcNeedThrowException(int error)
  54. {
  55. if (error == 0)
  56. {
  57. return false;
  58. }
  59. // ws平台返回错误专用的值
  60. if (error == -1)
  61. {
  62. return false;
  63. }
  64. if (error > ERR_Exception)
  65. {
  66. return false;
  67. }
  68. return true;
  69. }
  70. public static bool IsTargetNotOnline(this int error)
  71. {
  72. if (error == ERR_NotFoundActor)
  73. {
  74. return true;
  75. }
  76. return false;
  77. }
  78. }
  79. }