ErrorCode.cs 3.4 KB

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