Add ability to handle curl errors to the CurlConsumer

Add ability to handle curl errors if occurred.
Error code for curl is always non-zero in this situation, so it can be easily distinct from api error.
"if" placement is directed by requirement of non-closed curl handler (to get error) and hypothetical exception throwing from error handler (so curl should be closed before handler call).