Reference / @getenginex/sdk / isEnginexError
isEnginexError()
Call Signature
isEnginexError(
value):value is EnginexError
Tells whether the value is an EnginexError.
Parameters
value
unknown
Returns
value is EnginexError
Call Signature
isEnginexError<
C>(value,code):value is EnginexError & { code: C; details: C extends "captcha_required" ? ErrorDetailsMap[C] : unknown }
Tells whether the value is an EnginexError with the given code. When code is in ErrorDetailsMap (e.g. 'captcha_required'), details comes typed; otherwise, unknown.
Type Parameters
C
C extends EnginexErrorCode
Parameters
value
unknown
code
C
Returns
value is EnginexError & { code: C; details: C extends "captcha_required" ? ErrorDetailsMap[C] : unknown }
Example
ts
if (isEnginexError(e, 'captcha_required')) showCaptcha(e.details?.site_key)