Skip to content

Commit

Permalink
Fix error message in Hook Twilio guide (#22463)
Browse files Browse the repository at this point in the history
Co-authored-by: Pascal Jufer <[email protected]>
  • Loading branch information
Oleksii909 and paescuj committed May 13, 2024
1 parent 7e7dc85 commit d0593f2
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit d0593f2

Please sign in to comment.