On Apr 30, 2020, at 15:14, Dan Campbell <dcwhat...@gmail.com> wrote:
> 
> Hi, what range of error codes are recommended, if we wanted to return a 
> user-defined code?
> 
> Obviously, we don't want to use a code in the 200+ range, or the 400+ range, 
> e.g.
> 
> I want to throw, or just return, a code that represents that the size of a 
> web page (len(response.content)) is less than the expected size.

You can create your own internal codes as long as they don’t clash with the 
standard code. If the custom code is for a success, a 2xx code would be 
appropriate. If it is a user error, you could use a 4xx code.

However, I would prefer to use the standard codes, and add a custom header with 
more information on the issue.


-- Ed Leafe






-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to