ErrorCode.cs 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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_ActorNoMailBoxComponent = 110003;
  29. public const int ERR_ActorLocationSenderTimeout = 110004;
  30. public const int ERR_PacketParserError = 110005;
  31. public const int ERR_KcpChannelAcceptTimeout = 110206;
  32. public const int ERR_KcpRemoteDisconnect = 110207;
  33. public const int ERR_WebsocketError = 110303;
  34. public const int ERR_WebsocketConnectError = 110304;
  35. public const int ERR_RpcFail = 110307;
  36. public const int ERR_ReloadFail = 110308;
  37. public const int ERR_ConnectGateKeyError = 110309;
  38. public const int ERR_SessionSendOrRecvTimeout = 110311;
  39. public const int ERR_OuterSessionRecvInnerMessage = 110312;
  40. public const int ERR_NotFoundActor = 110313;
  41. public const int ERR_ActorTimeout = 110315;
  42. public const int ERR_UnverifiedSessionSendMessage = 110316;
  43. public const int ERR_ActorLocationSenderTimeout2 = 110317;
  44. public const int ERR_ActorLocationSenderTimeout3 = 110318;
  45. public const int ERR_ActorLocationSenderTimeout4 = 110319;
  46. public const int ERR_ActorLocationSenderTimeout5 = 110320;
  47. public const int ERR_KcpRouterTimeout = 110401;
  48. public const int ERR_KcpRouterTooManyPackets = 110402;
  49. public const int ERR_KcpRouterSame = 110402;
  50. //-----------------------------------
  51. // 小于这个Rpc会抛异常,大于这个异常的error需要自己判断处理,也就是说需要处理的错误应该要大于该值
  52. public const int ERR_Exception = 200000;
  53. public const int ERR_Cancel = 200001;
  54. public static bool IsRpcNeedThrowException(int error)
  55. {
  56. if (error == 0)
  57. {
  58. return false;
  59. }
  60. // ws平台返回错误专用的值
  61. if (error == -1)
  62. {
  63. return false;
  64. }
  65. if (error > ERR_Exception)
  66. {
  67. return false;
  68. }
  69. return true;
  70. }
  71. public static bool IsTargetNotOnline(this int error)
  72. {
  73. if (error == ERR_NotFoundActor)
  74. {
  75. return true;
  76. }
  77. return false;
  78. }
  79. }
  80. }