# NSError

## Field Summary <a href="#field-summary" id="field-summary"></a>

| Type   | Field                                  |
| ------ | -------------------------------------- |
| Int    | code - *Error code*                    |
| String | localizedDescription - *Error message* |

## User Error codes <a href="#user-error-codes" id="user-error-codes"></a>

| Codes | Errors                | Description                                                                                                                                                                                                          |
| ----- | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 101   | userGeneric           | <ul><li>Invalid participant type</li><li>Target client is not is not available while in the process of media (un)subscription</li><li>ICE candidates queue overflow</li></ul>                                        |
| 102   | userNotFound          | <ul><li>Attempting to execute request before joining the Session</li><li>Addressing client that is not in the Session</li></ul>                                                                                      |
| 103   | userClosedError       | <ul><li>Source or target user has left the Session during the media subscription process</li><li>Target user has left the Session during SDP exchange</li></ul>                                                      |
| 104   | existingUserInSession | A Participant tries to join a Session with a name that already exists                                                                                                                                                |
| 105   | userNotStreaming      | <ul><li>Attempting to start a stream with no video and audio</li><li>Attempting to send SDP response when there was no offer</li><li>Attempting to subscribe to a client that did not publish anything yet</li></ul> |
| 106   | userNotAuthorized     | <ul><li>Attempting to send synchronization data while not having a synchronizer role</li><li>Invalid oldParticipantSecret during reconnection</li></ul>                                                              |

## Session Error codes <a href="#session-error-codes" id="session-error-codes"></a>

| Codes | Errors              | Description                                                                                                                                                                      |
| ----- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 201   | sessionGenericError | <ul><li>Unable to handle the request as the Session is locked </li><li>Active requests counter underflow (Internal server logic)</li><li>The Session is already locked</li></ul> |
| 203   | sessionClosed       |                                                                                                                                                                                  |
| 206   | sessionIsFull       | Exceeded limit of streaming participants in the room                                                                                                                             |

## Media Error codes <a href="#media-error-codes" id="media-error-codes"></a>

| Codes | Errors        | Description                                                                                                                                                                   |
| ----- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 303   | mediaEndpoint | <ul><li>Already subscribed to media stream from target client</li><li>SDP exchange for this media stream is already in progress</li><li>Timeout during SDP exchange</li></ul> |

## Transport Error codes <a href="#transport-error-codes" id="transport-error-codes"></a>

| Codes | Errors            | Description                                                                                |
| ----- | ----------------- | ------------------------------------------------------------------------------------------ |
| 801   | transportRequest  | Failed to make request to media node                                                       |
| 802   | transportResponse | Invalid response from media node                                                           |
| 803   | transport         | <ul><li>Request method is not supported</li><li>Invalid or missing request field</li></ul> |

## Generic Error codes <a href="#generic-error-codes" id="generic-error-codes"></a>

| Codes | Errors                 | Description                                                                       |
| ----- | ---------------------- | --------------------------------------------------------------------------------- |
| -1    | unknownError           | Internal server error                                                             |
| 901   | genericConnectionError | The Client closed the connection in the middle of the process of joining the room |
| 999   | genericError           | The Request is not supported                                                      |

## Token Errors <a href="#token-errors" id="token-errors"></a>

| Codes | Errors               |
| ----- | -------------------- |
| 1101  | invalidToken         |
| 1102  | invalidTokenData     |
| 1103  | invalidTokenJsonData |

## Socket Erros <a href="#socket-erros" id="socket-erros"></a>

| Codes | Errors            |
| ----- | ----------------- |
| 1104  | invalidSocketURL  |
| 1105  | invalidStunServer |
