• 附录:Swoole错误码列表

    附录:Swoole错误码列表

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

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

    1. echo swoole_strerror(swoole_last_error(), 9) . PHP_EOL;
    2. echo swoole_strerror(SWOOLE_ERROR_MALLOC_FAIL, 9) . PHP_EOL;
    Constants NameValueDescription含义
    SWOOLE_ERROR_MALLOC_FAIL501malloc fail
    SWOOLE_ERROR_SYSTEM_CALL_FAIL502system call fail
    SWOOLE_ERROR_PHP_FATAL_ERROR503php fatal error
    SWOOLE_ERROR_NAME_TOO_LONG504name too long
    SWOOLE_ERROR_INVALID_PARAMS505invalid params
    SWOOLE_ERROR_QUEUE_FULL506queue full
    -
    SWOOLE_ERROR_FILE_NOT_EXIST700file not exist
    SWOOLE_ERROR_FILE_TOO_LARGE701file too large
    SWOOLE_ERROR_FILE_EMPTY702file empty
    SWOOLE_ERROR_DNSLOOKUP_DUPLICATE_REQUEST703dnslookup duplicate request
    SWOOLE_ERROR_DNSLOOKUP_RESOLVE_FAILED704dnslookup resolve failed
    SWOOLE_ERROR_DNSLOOKUP_RESOLVE_TIMEOUT705dnslookup resolve timeout
    SWOOLE_ERROR_BAD_IPV6_ADDRESS706bad ipv6 address
    SWOOLE_ERROR_UNREGISTERED_SIGNAL707unregistered signal
    -
    SWOOLE_ERROR_SESSION_CLOSED_BY_SERVER1001session closed by server
    SWOOLE_ERROR_SESSION_CLOSED_BY_CLIENT1002session closed by client
    SWOOLE_ERROR_SESSION_CLOSING1003session closing
    SWOOLE_ERROR_SESSION_CLOSED1004session closed
    SWOOLE_ERROR_SESSION_NOT_EXIST1005session not exist
    SWOOLE_ERROR_SESSION_INVALID_ID1006session invalid id
    SWOOLE_ERROR_SESSION_DISCARD_TIMEOUT_DATA1007session discard timeout data
    SWOOLE_ERROR_OUTPUT_BUFFER_OVERFLOW1008output buffer overflow
    SWOOLE_ERROR_SSL_NOT_READY1009ssl not ready
    SWOOLE_ERROR_SSL_CANNOT_USE_SENFILE1010ssl cannot use senfile
    SWOOLE_ERROR_SSL_EMPTY_PEER_CERTIFICATE1011ssl empty peer certificate
    SWOOLE_ERROR_SSL_VEFIRY_FAILED1012ssl vefiry failed
    SWOOLE_ERROR_SSL_BAD_CLIENT1013ssl bad client
    SWOOLE_ERROR_SSL_BAD_PROTOCOL1014ssl bad protocol
    -
    SWOOLE_ERROR_PACKAGE_LENGTH_TOO_LARGE1201package length too large
    SWOOLE_ERROR_DATA_LENGTH_TOO_LARGE1202data length too large
    -
    SWOOLE_ERROR_TASK_PACKAGE_TOO_BIG2001task package too big
    SWOOLE_ERROR_TASK_DISPATCH_FAIL2002task dispatch fail
    -
    SWOOLE_ERROR_HTTP2_STREAM_ID_TOO_BIG3001http2 stream id too big
    SWOOLE_ERROR_HTTP2_STREAM_NO_HEADER3002http2 stream no header
    SWOOLE_ERROR_HTTP2_STREAM_NOT_FOUND3003http2 stream not found
    -
    SWOOLE_ERROR_AIO_BAD_REQUEST4001Raio bad request
    SWOOLE_ERROR_AIO_CANCELED4002aio canceled
    -
    SWOOLE_ERROR_CLIENT_NO_CONNECTION5001client no connection
    SWOOLE_ERROR_SOCKET_CLOSED5002socket closed
    SWOOLE_ERROR_SOCKS5_UNSUPPORT_VERSION7001socks5 unsupport version
    SWOOLE_ERROR_SOCKS5_UNSUPPORT_METHOD7002socks5 unsupport method
    SWOOLE_ERROR_SOCKS5_AUTH_FAILED7003socks5 auth failed
    SWOOLE_ERROR_SOCKS5_SERVER_ERROR7004socks5 server error
    -
    SWOOLE_ERROR_HTTP_PROXY_HANDSHAKE_ERROR8001http proxy handshake error
    SWOOLE_ERROR_HTTP_INVALID_PROTOCOL8002http invalid protocol
    -
    SWOOLE_ERROR_WEBSOCKET_BAD_CLIENT8501websocket bad client
    SWOOLE_ERROR_WEBSOCKET_BAD_OPCODE8502websocket bad opcode
    SWOOLE_ERROR_WEBSOCKET_UNCONNECTED8503websocket unconnected
    SWOOLE_ERROR_WEBSOCKET_HANDSHAKE_FAILED8504websocket handshake failed
    -
    SWOOLE_ERROR_SERVER_MUST_CREATED_BEFORE_CLIENT9001server must created before client
    SWOOLE_ERROR_SERVER_TOO_MANY_SOCKET9002server too many socket
    SWOOLE_ERROR_SERVER_WORKER_TERMINATED9003server worker terminated
    SWOOLE_ERROR_SERVER_INVALID_LISTEN_PORT9004server invalid listen port
    SWOOLE_ERROR_SERVER_TOO_MANY_LISTEN_PORT9005server too many listen port
    SWOOLE_ERROR_SERVER_PIPE_BUFFER_FULL9006server pipe buffer full
    SWOOLE_ERROR_SERVER_NO_IDLE_WORKER9007server no idle worker
    SWOOLE_ERROR_SERVER_ONLY_START_ONE9008server only start one
    SWOOLE_ERROR_SERVER_SEND_IN_MASTER9009server send in master
    SWOOLE_ERROR_SERVER_INVALID_REQUEST9010server invalid request
    SWOOLE_ERROR_SERVER_WORKER_EXIT_TIMEOUT9011server worker exit timeout
    -
    SWOOLE_ERROR_CO_OUT_OF_COROUTINE10001coroutine out of coroutine
    SWOOLE_ERROR_CO_HAS_BEEN_BOUND10002coroutine has been bound
    SWOOLE_ERROR_CO_MUTEX_DOUBLE_UNLOCK10003coroutine mutex double unlock
    SWOOLE_ERROR_CO_BLOCK_OBJECT_LOCKED10004coroutine block object locked
    SWOOLE_ERROR_CO_BLOCK_OBJECT_WAITING10005coroutine block object waiting
    SWOOLE_ERROR_CO_YIELD_FAILED10006coroutine yield failed
    SWOOLE_ERROR_CO_GETCONTEXT_FAILED10007coroutine getcontext failed
    SWOOLE_ERROR_CO_SWOOLEAPCONTEXT_FAILED10008coroutine swapcontext failed
    SWOOLE_ERROR_CO_MAKECONTEXT_FAILED10009coroutine makecontext failed
    SWOOLE_ERROR_CO_IOCPINIT_FAILED10010coroutine iocpinit failed
    SWOOLE_ERROR_CO_PROTECT_STACK_FAILED10011coroutine protect stack failed
    SWOOLE_ERROR_CO_STD_THREAD_LINK_ERROR10012coroutine std thread link error
    SWOOLE_ERROR_CO_DISABLED_MULTI_THREAD10013coroutine disabled multi thread