Class RpcError
- Namespace
- LiveKit.Rtc
- Assembly
- LivekitRtc.dll
Specialized error handling for RPC methods. Instances of this type, when thrown in a method handler, will have their message serialized and sent across the wire.
public class RpcError : Exception, ISerializable
- Inheritance
-
RpcError
- Implements
- Inherited Members
Constructors
RpcError(RpcErrorCode, string?, string?)
Creates an error from an error code enum.
public RpcError(RpcErrorCode code, string? message = null, string? data = null)
Parameters
codeRpcErrorCodeThe error code.
messagestringOptional custom message.
datastringOptional additional data.
RpcError(int, string, string?)
Creates an error object with the given code and message, plus an optional data payload.
public RpcError(int code, string message, string? data = null)
Parameters
codeintYour error code (Error codes 1001-1999 are reserved for built-in errors).
messagestringA readable error message.
datastringOptional additional data associated with the error (JSON recommended).
Properties
Code
Gets the error code.
public int Code { get; }
Property Value
RpcData
Gets optional additional data associated with the error (JSON recommended).
public string? RpcData { get; }
Property Value
Methods
BuiltIn(RpcErrorCode, string?)
Creates a built-in error from an error code.
public static RpcError BuiltIn(RpcErrorCode code, string? data = null)
Parameters
codeRpcErrorCodeThe error code.
datastringOptional additional data.
Returns
- RpcError
A new RpcError instance.