Skip to content

wrapError()

SIP Protocol API Reference v0.7.4


SIP Protocol API Reference / wrapError

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

Defined in: @sip-protocol/sdk/dist/index-DXh2IGkz.d.ts:342

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)
}