附录:Swoole错误码列表
最后更新于:2022-04-02 06:42:05
# 附录:Swoole错误码列表
可使用`swoole_last_error()`获取当前的错误码
可使用`swoole_strerror(int $errno, 9);`将`Swoole`底层错误码转换成文字错误信息:
~~~
echo swoole_strerror(swoole_last_error(), 9) . PHP_EOL;
echo swoole_strerror(SWOOLE_ERROR_MALLOC_FAIL, 9) . PHP_EOL;
~~~
| Constants Name | Value | Description | 含义 |
| --- | --- | --- | --- |
| SWOOLE\_ERROR\_MALLOC\_FAIL | 501 | malloc fail | |
| SWOOLE\_ERROR\_SYSTEM\_CALL\_FAIL | 502 | system call fail | |
| SWOOLE\_ERROR\_PHP\_FATAL\_ERROR | 503 | php fatal error | |
| SWOOLE\_ERROR\_NAME\_TOO\_LONG | 504 | name too long | |
| SWOOLE\_ERROR\_INVALID\_PARAMS | 505 | invalid params | |
| SWOOLE\_ERROR\_QUEUE\_FULL | 506 | queue full | |
| \- | | | |
| SWOOLE\_ERROR\_FILE\_NOT\_EXIST | 700 | file not exist | |
| SWOOLE\_ERROR\_FILE\_TOO\_LARGE | 701 | file too large | |
| SWOOLE\_ERROR\_FILE\_EMPTY | 702 | file empty | |
| SWOOLE\_ERROR\_DNSLOOKUP\_DUPLICATE\_REQUEST | 703 | dnslookup duplicate request | |
| SWOOLE\_ERROR\_DNSLOOKUP\_RESOLVE\_FAILED | 704 | dnslookup resolve failed | |
| SWOOLE\_ERROR\_DNSLOOKUP\_RESOLVE\_TIMEOUT | 705 | dnslookup resolve timeout | |
| SWOOLE\_ERROR\_BAD\_IPV6\_ADDRESS | 706 | bad ipv6 address | |
| SWOOLE\_ERROR\_UNREGISTERED\_SIGNAL | 707 | unregistered signal | |
| \- | | | |
| SWOOLE\_ERROR\_SESSION\_CLOSED\_BY\_SERVER | 1001 | session closed by server | |
| SWOOLE\_ERROR\_SESSION\_CLOSED\_BY\_CLIENT | 1002 | session closed by client | |
| SWOOLE\_ERROR\_SESSION\_CLOSING | 1003 | session closing | |
| SWOOLE\_ERROR\_SESSION\_CLOSED | 1004 | session closed | |
| SWOOLE\_ERROR\_SESSION\_NOT\_EXIST | 1005 | session not exist | |
| SWOOLE\_ERROR\_SESSION\_INVALID\_ID | 1006 | session invalid id | |
| SWOOLE\_ERROR\_SESSION\_DISCARD\_TIMEOUT\_DATA | 1007 | session discard timeout data | |
| SWOOLE\_ERROR\_OUTPUT\_BUFFER\_OVERFLOW | 1008 | output buffer overflow | |
| SWOOLE\_ERROR\_SSL\_NOT\_READY | 1009 | ssl not ready | |
| SWOOLE\_ERROR\_SSL\_CANNOT\_USE\_SENFILE | 1010 | ssl cannot use senfile | |
| SWOOLE\_ERROR\_SSL\_EMPTY\_PEER\_CERTIFICATE | 1011 | ssl empty peer certificate | |
| SWOOLE\_ERROR\_SSL\_VEFIRY\_FAILED | 1012 | ssl vefiry failed | |
| SWOOLE\_ERROR\_SSL\_BAD\_CLIENT | 1013 | ssl bad client | |
| SWOOLE\_ERROR\_SSL\_BAD\_PROTOCOL | 1014 | ssl bad protocol | |
| \- | | | |
| SWOOLE\_ERROR\_PACKAGE\_LENGTH\_TOO\_LARGE | 1201 | package length too large | |
| SWOOLE\_ERROR\_DATA\_LENGTH\_TOO\_LARGE | 1202 | data length too large | |
| \- | | | |
| SWOOLE\_ERROR\_TASK\_PACKAGE\_TOO\_BIG | 2001 | task package too big | |
| SWOOLE\_ERROR\_TASK\_DISPATCH\_FAIL | 2002 | task dispatch fail | |
| \- | | | |
| SWOOLE\_ERROR\_HTTP2\_STREAM\_ID\_TOO\_BIG | 3001 | http2 stream id too big | |
| SWOOLE\_ERROR\_HTTP2\_STREAM\_NO\_HEADER | 3002 | http2 stream no header | |
| SWOOLE\_ERROR\_HTTP2\_STREAM\_NOT\_FOUND | 3003 | http2 stream not found | |
| \- | | | |
| SWOOLE\_ERROR\_AIO\_BAD\_REQUEST | 4001 | Raio bad request | |
| SWOOLE\_ERROR\_AIO\_CANCELED | 4002 | aio canceled | |
| \- | | | |
| SWOOLE\_ERROR\_CLIENT\_NO\_CONNECTION | 5001 | client no connection | |
| SWOOLE\_ERROR\_SOCKET\_CLOSED | 5002 | socket closed | |
| SWOOLE\_ERROR\_SOCKS5\_UNSUPPORT\_VERSION | 7001 | socks5 unsupport version | |
| SWOOLE\_ERROR\_SOCKS5\_UNSUPPORT\_METHOD | 7002 | socks5 unsupport method | |
| SWOOLE\_ERROR\_SOCKS5\_AUTH\_FAILED | 7003 | socks5 auth failed | |
| SWOOLE\_ERROR\_SOCKS5\_SERVER\_ERROR | 7004 | socks5 server error | |
| \- | | | |
| SWOOLE\_ERROR\_HTTP\_PROXY\_HANDSHAKE\_ERROR | 8001 | http proxy handshake error | |
| SWOOLE\_ERROR\_HTTP\_INVALID\_PROTOCOL | 8002 | http invalid protocol | |
| \- | | | |
| SWOOLE\_ERROR\_WEBSOCKET\_BAD\_CLIENT | 8501 | websocket bad client | |
| SWOOLE\_ERROR\_WEBSOCKET\_BAD\_OPCODE | 8502 | websocket bad opcode | |
| SWOOLE\_ERROR\_WEBSOCKET\_UNCONNECTED | 8503 | websocket unconnected | |
| SWOOLE\_ERROR\_WEBSOCKET\_HANDSHAKE\_FAILED | 8504 | websocket handshake failed | |
| \- | | | |
| SWOOLE\_ERROR\_SERVER\_MUST\_CREATED\_BEFORE\_CLIENT | 9001 | server must created before client | |
| SWOOLE\_ERROR\_SERVER\_TOO\_MANY\_SOCKET | 9002 | server too many socket | |
| SWOOLE\_ERROR\_SERVER\_WORKER\_TERMINATED | 9003 | server worker terminated | |
| SWOOLE\_ERROR\_SERVER\_INVALID\_LISTEN\_PORT | 9004 | server invalid listen port | |
| SWOOLE\_ERROR\_SERVER\_TOO\_MANY\_LISTEN\_PORT | 9005 | server too many listen port | |
| SWOOLE\_ERROR\_SERVER\_PIPE\_BUFFER\_FULL | 9006 | server pipe buffer full | |
| SWOOLE\_ERROR\_SERVER\_NO\_IDLE\_WORKER | 9007 | server no idle worker | |
| SWOOLE\_ERROR\_SERVER\_ONLY\_START\_ONE | 9008 | server only start one | |
| SWOOLE\_ERROR\_SERVER\_SEND\_IN\_MASTER | 9009 | server send in master | |
| SWOOLE\_ERROR\_SERVER\_INVALID\_REQUEST | 9010 | server invalid request | |
| SWOOLE\_ERROR\_SERVER\_WORKER\_EXIT\_TIMEOUT | 9011 | server worker exit timeout | |
| \- | | | |
| SWOOLE\_ERROR\_CO\_OUT\_OF\_COROUTINE | 10001 | coroutine out of coroutine | |
| SWOOLE\_ERROR\_CO\_HAS\_BEEN\_BOUND | 10002 | coroutine has been bound | |
| SWOOLE\_ERROR\_CO\_MUTEX\_DOUBLE\_UNLOCK | 10003 | coroutine mutex double unlock | |
| SWOOLE\_ERROR\_CO\_BLOCK\_OBJECT\_LOCKED | 10004 | coroutine block object locked | |
| SWOOLE\_ERROR\_CO\_BLOCK\_OBJECT\_WAITING | 10005 | coroutine block object waiting | |
| SWOOLE\_ERROR\_CO\_YIELD\_FAILED | 10006 | coroutine yield failed | |
| SWOOLE\_ERROR\_CO\_GETCONTEXT\_FAILED | 10007 | coroutine getcontext failed | |
| SWOOLE\_ERROR\_CO\_SWOOLEAPCONTEXT\_FAILED | 10008 | coroutine swapcontext failed | |
| SWOOLE\_ERROR\_CO\_MAKECONTEXT\_FAILED | 10009 | coroutine makecontext failed | |
| SWOOLE\_ERROR\_CO\_IOCPINIT\_FAILED | 10010 | coroutine iocpinit failed | |
| SWOOLE\_ERROR\_CO\_PROTECT\_STACK\_FAILED | 10011 | coroutine protect stack failed | |
| SWOOLE\_ERROR\_CO\_STD\_THREAD\_LINK\_ERROR | 10012 | coroutine std thread link error | |
| SWOOLE\_ERROR\_CO\_DISABLED\_MULTI\_THREAD | 10013 | coroutine disabled multi thread | |
';