Skip to content

Instantly share code, notes, and snippets.

@Tuan-T-Nguyen
Last active November 21, 2020 03:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tuan-T-Nguyen/b50a8350e442d9b1efb2911db2eb319c to your computer and use it in GitHub Desktop.
Save Tuan-T-Nguyen/b50a8350e442d9b1efb2911db2eb319c to your computer and use it in GitHub Desktop.
error code api

Reference: https://www.twilio.com/docs/api/errors

Error Status code

400 Bad Request

Possible Causes

  • The resource to be modified has moved into a state that is no longer valid.
  • Input on the request did not pass validation.

Possible Solutions

  • Retry the request after confirming the request is valid.
  • Verify if the resource to be modified exists and is in a valid state.

404 Not Found

Possible Causes

  • The specified resource is no longer available.

Possible Solutions

  • The specified resource is no longer available.

500 Internal Server Error

This error response is a generic "catch-all" response.

Define code number when error controlled

Example

21211 Invalid 'To' Phone Number

Status code will be 400 and response will be something like this

Reference link: https://www.twilio.com/docs/usage/troubleshooting/debugging-your-application#debugging-calls-to-the-rest-api

{
  "code": 21211,
  "message": "The 'To' number 5551234567 is not a valid phone number.",
  "more_info": "https://www.twilio.com/docs/errors/21211",
  "status": 400
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment