Skip to content

wrapError()

SIP Protocol API Reference v0.7.0


SIP Protocol API Reference / wrapError

wrapError(error, message, code?, context?): SIPError

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:290

Wrap an unknown error as a SIPError

Useful for catching and re-throwing with additional context.

unknown

string

ErrorCode

Record<string, unknown>

SIPError

try {
await riskyOperation()
} catch (e) {
throw wrapError(e, 'Operation failed', ErrorCode.INTERNAL)
}