Return correct error codes from Curl