附录:Swoole错误码列表

可使用swoole_last_errno();获取当前的错误码

可使用swoole_strerror(int $errno, 9);将Swoole底层错误码转换成文字错误信息:

<?php
    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