|
LiveKit C++ SDK
Real-time audio/video SDK for C++
|
#include <rpc_error.h>


Public Types | |
| enum class | ErrorCode : std::uint32_t { APPLICATION_ERROR = 1500 , CONNECTION_TIMEOUT = 1501 , RESPONSE_TIMEOUT = 1502 , RECIPIENT_DISCONNECTED = 1503 , RESPONSE_PAYLOAD_TOO_LARGE = 1504 , SEND_FAILED = 1505 , UNSUPPORTED_METHOD = 1400 , RECIPIENT_NOT_FOUND = 1401 , REQUEST_PAYLOAD_TOO_LARGE = 1402 , UNSUPPORTED_SERVER = 1403 , UNSUPPORTED_VERSION = 1404 } |
Public Member Functions | |
| RpcError (std::uint32_t code, std::string message, std::string data={}) | |
| RpcError (ErrorCode code, std::string message, std::string data={}) | |
| std::uint32_t | code () const noexcept |
| const std::string & | message () const noexcept |
| const std::string & | data () const noexcept |
Static Public Member Functions | |
| static RpcError | builtIn (ErrorCode code, const std::string &data={}) |
Protected Member Functions | |
| proto::RpcError | toProto () const |
Static Protected Member Functions | |
| static RpcError | fromProto (const proto::RpcError &err) |
Friends | |
| class | LocalParticipant |
| class | FfiClient |
Specialized error type for RPC methods.
Instances of this type, when thrown in a method handler, will have their code, message, and optional data serialized into a proto::RpcError and sent across the wire. The caller will receive an equivalent error on the other side.
Built-in errors are included (codes 1400–1999) but developers may use arbitrary codes as well.
|
strong |
Built-in error codes
| livekit::RpcError::RpcError | ( | std::uint32_t | code, |
| std::string | message, | ||
| std::string | data = {} |
||
| ) |
Construct an RpcError with an explicit numeric code.
| code | Error code value. Codes 1001–1999 are reserved for built-in errors (see ErrorCode). |
| message | Human-readable error message. |
| data | Optional extra data, e.g. JSON. Empty string means no data. |
| livekit::RpcError::RpcError | ( | ErrorCode | code, |
| std::string | message, | ||
| std::string | data = {} |
||
| ) |
Construct an RpcError from a built-in ErrorCode.
| code | Built-in error code. |
| message | Human-readable error message. |
| data | Optional extra data, e.g. JSON. Empty string means no data. |
Create a built-in RpcError using a predefined ErrorCode and default message text.
| code | Built-in error code. |
| data | Optional extra data payload (JSON recommended). |
|
noexcept |
Numeric error code.
Codes 1001–1999 are reserved for built-in errors. For built-ins, this value matches the underlying ErrorCode enum value.
|
noexcept |
Optional extra data associated with the error (JSON recommended). May be an empty string if no data was provided.
|
noexcept |
Human-readable error message.