validateTwilioOptions
function validateTwilioOptions(options): void;Defined in: lib/utils/twilio.utils.ts:36
Validates Twilio module options at bootstrap.
Runs automatically inside createTwilioClient and during module initialisation. Call it directly only when you want to fail earlier, for example while loading configuration.
Error messages name the offending field and never include its value, so a failure is safe to log.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options |
TwilioModuleOptions & Partial<{ }> |
The options that would be passed to forRoot(). |
Returns
Section titled “Returns”void
Throws
Section titled “Throws”BadRequestException When a required field is missing or malformed.
Example
Section titled “Example”// Fail fast in a config factory, before Nest builds the module.const options = { accountSid: process.env.TWILIO_ACCOUNT_SID!, authToken: process.env.TWILIO_AUTH_TOKEN!,};
validateTwilioOptions(options);// Throws: "TwilioModule: accountSid should start with \"AC\""