Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error message in Hook Twilio guide #22463

Merged
merged 5 commits into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/guides/extensions/hooks-validate-number-twilio.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ underneath the collection restriction.

```js
if (input.phone_number === undefined) {
throw new InvalidPayloadError('No Phone Number has been provided');
throw new InvalidPayloadError({ reason: 'No Phone Number has been provided' });
}
```

Expand Down Expand Up @@ -101,7 +101,7 @@ client.lookups.v2
.fetch()
.then((phoneNumber) => {
if (!phoneNumber.valid) { // [!code ++]
throw new InvalidPayloadError('Phone Number is not valid'); // [!code ++]
throw new InvalidPayloadError({ reason: 'Phone Number is not valid' }); // [!code ++]
} // [!code ++]
// [!code ++]
return input; // [!code ++]
Expand Down Expand Up @@ -153,7 +153,7 @@ export default ({ filter }, { env }) => {
if (collection !== 'customers') return input;

if (input.phone_number === undefined) {
throw new InvalidPayloadError('No Phone Number has been provided');
throw new InvalidPayloadError({ reason: 'No Phone Number has been provided' });
}

const accountSid = env.TWILIO_ACCOUNT_SID;
Expand All @@ -165,7 +165,7 @@ export default ({ filter }, { env }) => {
.fetch()
.then((phoneNumber) => {
if (!phoneNumber.valid) {
throw new InvalidPayloadError('Phone Number is not valid');
throw new InvalidPayloadError({ reason: 'Phone Number is not valid' });
}

return input;
Expand Down
Loading