SMeetingError, a semantic Swift enum that also provides integer error codes unified across platforms.
- Use
switchto branch on meaning - Use
error.codeto get the full error code anderror.baseCodeto get the low 3-digit semantic code, handy for logs, support tickets, and cross-platform comparison - Use
error.messageto get the English description;error.localizedDescriptionoutputs"<code>: <message>" - Errors from the RTC layer (capture, permissions, publishing and subscribing) are passed through unchanged as
SRTCError; see SRTC error codes
Since 1.4.0, error codes are adjusted according to the cross-platform unified table, and error messages are in English. For the mapping between the old codes (1.3.10 and earlier) and the new ones, see the Changelog.
Error list
message is an English description for developers and logs. For messages shown to end users, map code / baseCode yourself—don’t show message directly.
Server codes that need special handling
The following two server codes are thrown byenterRoom (apiError) and are not failures. The SDK provides constants for them (since 1.14.0); check with error.code == SMeetingError.xxxCode:
Call
exitWaitingRoom when leaving either kind of waiting page; if the meeting ends or is cancelled while waiting, imWaitingMeetingEnd arrives. See Waiting room.
Error code format
SMeetingError.code returns the full error code:
- Client errors: platform prefix + a 3-digit low code. The iOS prefix is
203and the macOS prefix is205 - Errors passed through from the server (
apiErrorwith a server code of 1000 or greater) are kept as-is, without a prefix - HTTP status codes are never folded into the error code: non-200 HTTP responses are always
007(httpError), with the status inhttpStatus
baseCode is the low 3-digit semantic code and means the same as on Web, Android, HarmonyOS, and other platforms; for server codes, baseCode returns the code itself.
Examples:
This lets you tell at a glance whether an error was “stopped by the client itself” or “returned by the server.”
SMeetingError implements CustomNSError: once bridged to NSError, domain = "cn.seastart.smeeting" and code is the full code. Integrations that go through NSError, such as ObjC, uni-app, or Flutter, can check the code directly.
Error language
meeting.language (such as "en" or "zh-CN"; nil follows the system language) is the same process-wide setting as the SRTC layer’s language. Requests from both the meeting layer and the RTC layer to the backend carry Accept-Language, and the messages of backend business errors (codes ≥ 1000) come back in Chinese or English accordingly; the SDK’s own errors are always in English and aren’t affected.
Common sources of unauthorized
This is the error you’re most likely to run into, and it almost always comes from room policies:
We recommend graying out buttons in the UI in advance based on
RoomInfo, rather than letting users tap them and then get an error.
Recommended handling
- Besides
SMeetingError, the RTC layer’sSRTCErroris also thrown unchanged; handle both - The pre-call network check
networkCheck(since 1.11.0) also passes SRTC-layer codes through: a check already running isalreadyJoined(005), cancelled iscancelled(026), invalid parameters areinvalidArgument(031); only when not logged in and using the overload without parameters does it throw the meeting layer’snotLoggedIn(001) - For messages shown to end users, map
baseCodeto your own text; useerror.localizedDescriptionwhen writing logs, because it includes the error code SMeetingErrorconforms toEquatable, so you can compare it directly with a specific case; it’s distributed with library evolution enabled, and later versions may add cases, so keep adefaultbranch in yourswitch
APIs that don’t throw
The following APIs are designed not to throw, so you can call them directly; repeated calls or calls in a mismatched state are safely ignored:logout()exitRoom()closeMic()/closeCamera()/stopShare()disableIm()toggleRemoteAudioMute(_:)getRoomInfo()/getWhiteBoard()/getUsersInfo()/getUsersInfoList()/getRemoteVideoTrack(uid:desc:)/getDevices(kind:)