Skip to main content

JavaScript SDK API Reference / Utilities / check

Function: check()

check<T>(bool, error): void

Defined in: utils/check.ts:15

Throws error unless bool is true, preserving its concrete SNS error type.

Type Parameters​

T​

T extends SNSError

Parameters​

bool​

boolean

Condition that must be true

error​

T

Error to throw when bool is false

Returns​

void

Throws​

The supplied error when bool is false

Example​

check(value !== undefined, new InvalidInputError("A value is required"));