Get Started
Errors
You might encounter errors while using DotHost’s API. These errors are:
Error Codes
Understanding error codes is essential for managing requests and debugging issues in your application. Below are some common error codes categorized by their type.
1. Client Errors (4xx)
These errors indicate problems with the client request.
Example: 400 BAD_REQUEST
- Explanation: The client request was malformed. In this case, the email provided was not in a valid format.
Example: 302 FOUND
- Explanation: The request cannot be processed because the user already exists in the system. This is a redirect status, indicating that the action cannot be completed, and the user should take a different action (e.g., log in instead of signing up).
2. Server Errors (5xx)
These errors indicate issues on the server-side.
Example: 500 INTERNAL_SERVER_ERROR
- Explanation: The server encountered an unexpected condition that prevented it from fulfilling the request. This usually requires server-side troubleshooting.
Example: 502 BAD_GATEWAY
- Explanation: The server was acting as a gateway or proxy and received an invalid response from an upstream server.
3. Redirection Errors (3xx)
These errors indicate that the client should take additional actions to complete the request.
Example: 302 FOUND
- Explanation: A
302 FOUND
response means the user already exists, and the system is redirecting the client to a new action, such as logging in instead of signing up.
4. Success Codes (2xx)
These codes indicate successful requests.
Example: 200 OK
- Explanation: A
200 OK
response means that the request was successfully processed and the requested data is included in the response.
General Error Handling Tips:
- Client Errors (4xx): These usually require you to verify and correct your request data. Ensure that your inputs are valid.
- Server Errors (5xx): These indicate issues on the server side. You might need to contact support or wait for the issue to be resolved.
- Redirection Errors (3xx): These responses typically require you to take further action, like redirecting the user to a different page.
- Success Codes (2xx): These confirm that the request was successfully processed.
Handling errors properly ensures better user experience and smoother application performance. Always validate input and implement error handling to respond to different status codes effectively.
Was this page helpful?