Errors
When a request fails, Vetrol returns a JSON error object with details about what went wrong.
Error object
{
"error": "invalid_parameter",
"message": "The 'to' phone number is not a valid E.164 number.",
"status": 400,
"code": 21211,
"more_info": "https://developers.vetrol.io/docs/errors/21211"
}
| Field | Description |
|---|---|
error | Machine-readable error type |
message | Human-readable description |
status | HTTP status code |
code | Vetrol-specific error code |
more_info | Link to detailed documentation |
Common error codes
| Code | HTTP Status | Description |
|---|---|---|
20003 | 401 | Authentication failure |
20404 | 404 | Resource not found |
20429 | 429 | Rate limit exceeded |
21211 | 400 | Invalid phone number |
21408 | 400 | Permission to send to this region is not enabled |
30001 | 400 | Queue overflow |
Handling errors
- Node.js
- Python
try {
const message = await client.messages.create({ ... });
} catch (error) {
if (error.status === 429) {
// Handle rate limiting — back off and retry
console.error('Rate limited:', error.message);
} else if (error.status === 400) {
console.error('Bad request:', error.message, 'Code:', error.code);
} else {
throw error;
}
}
from vetrol.exceptions import VetrolRestException
try:
message = client.messages.create(...)
except VetrolRestException as e:
if e.status == 429:
print(f'Rate limited: {e.msg}')
else:
print(f'Error {e.code}: {e.msg}')