Closed jtemporal closed 5 years ago
+1
As described in #126 you can actually use the exception handler to return whatever you'd like in the case of an exception. This is a pretty flexible option which one can use to achieve this effect; the power is in your hands.
Notably, prior to #126 being merged, this was not the case for grequests.imap
where the exception handlers return value would be disregarded.
As such, will be closing this one for now, feel free to reopen for discussion.
Whenever an
Exception
is thrown by setting theself.response
variable to an emptyResponse
object allows anyone to easily mock the response information.Where is this PR coming from:
I wanted to create an
exception_handler
that returns an response object withstatus_code
set to 404 without having to import requests along side grequests.