Skip to content

Error codes

The wire error type is SuperLineError from @super-line/core. Throw one from a handler and the client's promise rejects with the same code (and optional data). For usage — throwing, catching, custom codes — see Handle errors.

ts
import { SuperLineError } from '@super-line/core'
throw new SuperLineError('FORBIDDEN', 'not a member', { room })
//                        code         message         optional data

Built-in codes

SuperLineErrorCode is the built-in set; code also accepts any custom string.

CodeMeaningTypical source
BAD_REQUESTmalformed / unprocessable requesta bad or aborted call
UNAUTHORIZEDnot authenticatedauthenticate rejected the handshake
FORBIDDENauthenticated but not alloweda denied subscribe or a policy/guard
NOT_FOUNDno such request/topic for this rolea cross-role call, an unopened doc
TIMEOUTno reply within the deadlinea request that exceeded timeoutMs
VALIDATIONpayload failed its schemainbound input/payload rejected
DISCONNECTEDthe connection droppedsocket lost before the reply
INTERNALunexpected server erroran unknown throw in a handler (details not leaked)

An unknown throw from a handler becomes INTERNAL so server internals aren't exposed. Custom codes are just strings — throw new SuperLineError('RATE_LIMITED', …) — and reach the client verbatim.

See the API reference for the class surface.

Released under the MIT License.