Skip to content
Julien edited this page Jun 1, 2019 · 6 revisions

Introduction

libtwirc will keep track of some possible errors. Once twirc_tick() or twirc_loop() return and indicate an error, you can check the code of last error that has occurred using twirc_get_last_error().

twirc_get_last_error()

The signature of this function is as follows:

int twirc_get_last_error(const twirc_state_t *s);

It will return 0 if no error has occurred so far, otherwise the error code of the last error we ran into.

Error codes

  • TWIRC_ERR_NONE
    No error occurred (that libtwirc knows of).

  • TWIRC_ERR_OUT_OF_MEMORY
    libtwirc couldn't allocate enough memory to operate properly.

  • TWIRC_ERR_SOCKET_CREATE
    An error occurred while trying to create a socket for the server connection.

  • TWIRC_ERR_SOCKET_CONNECT
    An error occurred while trying to connect.

  • TWIRC_ERR_SOCKET_SEND
    An error occurred while trying to send data.

  • TWIRC_ERR_SOCKET_RECV
    An error occurred while trying to receive data.

  • TWIRC_ERR_SOCKET_CLOSE
    An error occurred while trying to close the socket.

  • TWIRC_ERR_EPOLL_CREATE
    The polling mechanism could not be set up. You can check errno for further details.

  • TWIRC_ERR_EPOLL_CTL
    The polling mechanism could not be set up, because the socket could not be registered for input and output. You can check errno for further details.

  • TWIRC_ERR_EPOLL_WAIT
    Polling for events failed. The exact reason can be queried through errno.

  • TWIRC_ERR_EPOLL_SIG
    Polling for events failed because it was interrupted by a signal.

  • TWIRC_ERR_CONN_CLOSED
    The connection was closed by the Twitch server.

  • TWIRC_ERR_CONN_HANGUP
    The connection was closed unexpectedly.

  • TWIRC_ERR_CONN_SOCKET
    The connection was lost due to a socket error.

Clone this wiki locally