Table of Contents

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

code RpcErrorCode

The error code.

message string

Optional custom message.

data string

Optional 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

code int

Your error code (Error codes 1001-1999 are reserved for built-in errors).

message string

A readable error message.

data string

Optional additional data associated with the error (JSON recommended).

Properties

Code

Gets the error code.

public int Code { get; }

Property Value

int

RpcData

Gets optional additional data associated with the error (JSON recommended).

public string? RpcData { get; }

Property Value

string

Methods

BuiltIn(RpcErrorCode, string?)

Creates a built-in error from an error code.

public static RpcError BuiltIn(RpcErrorCode code, string? data = null)

Parameters

code RpcErrorCode

The error code.

data string

Optional additional data.

Returns

RpcError

A new RpcError instance.