Hallo allocaters!
It's me again, Rafiano. Now I want to tell you about custom error and status codes.
It's good to make a custom error specific to your application so the error will be as detail as it would be. The error must extend Exception class and you should override (optional) the __init__ method based on your need. If you don't need to override anything, you could simply add "pass" to the class.
Besides, I also defined the error code specific to my application. The numbering convention should follow the standards, which are:
- 1xx: Informational - Communicates transfer protocol-level information
- 2xx: Success -Indicates that the client’s request was accepted successfully.
- 3xx: Redirection - Indicates that the client must take some additional action in order to complete their request.
- 4xx: Client Error - This category of error status codes points the finger at clients.
- 5xx: Server Error - The server takes responsibility for these error status codes.
Here are the custom errors and status codes that I defined:
That's all from me. Thank you and see you in another posts (:
0 komentar:
Post a Comment