Type guard that checks whether a value is a RtcForgeError, optionally matching a specific error code.
The value to test, typically a caught unknown.
unknown
Optional
When provided, additionally requires the error's code to equal this value.
code
true if err is a RtcForgeError (and matches code when given), narrowing its type.
true
err
try { doWork()} catch (err) { if (isRtcForgeError(err, 'INVALID_ARGUMENT')) { // err is narrowed to RtcForgeError here retryWithDefaults() }} Copy
try { doWork()} catch (err) { if (isRtcForgeError(err, 'INVALID_ARGUMENT')) { // err is narrowed to RtcForgeError here retryWithDefaults() }}
Type guard that checks whether a value is a RtcForgeError, optionally matching a specific error code.