Error
When interacting with the Riddles API, error handling is crucial to ensure that your application can gracefully manage issues that arise. Here are examples of error handling responses for both posting and getting data from the API
Validation Error :
This error might occurs, when a request is malformed -- usually because a field has not been given the correct value type, or the JSON is misformatted. .
Example
{
"message": "riddle field is required",
"status": 422
}
Routes Error :
This error might occurs, by reaching wrong route.
Example
{
"message": "No such route exits",
"status": 404
}
Server Error :
This error might occurs, when an unexpected server error occurred.
Example
{
"message": "Internal server error",
"status": 500
}
Go back home.