Skip to content

Commit c18a87e

Browse files
committed
include curl code name in error strings
1 parent f2a8a7e commit c18a87e

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

src/BeSimple/SoapClient/Curl.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -214,30 +214,30 @@ private function execManualRedirect($redirects = 0)
214214
protected function getErrorCodeMapping()
215215
{
216216
return array(
217-
1 => 'Unknown protocol. Only http and https are allowed.', //CURLE_UNSUPPORTED_PROTOCOL
218-
3 => 'Unable to parse URL', //CURLE_URL_MALFORMAT
219-
5 => 'Could not connect to host', //CURLE_COULDNT_RESOLVE_PROXY
220-
6 => 'Could not connect to host', //CURLE_COULDNT_RESOLVE_HOST
221-
7 => 'Could not connect to host', //CURLE_COULDNT_CONNECT
222-
9 => 'Could not connect to host', //CURLE_REMOTE_ACCESS_DENIED
223-
28 => 'Failed Sending HTTP SOAP request', //CURLE_OPERATION_TIMEDOUT
224-
35 => 'Could not connect to host', //CURLE_SSL_CONNECT_ERROR
225-
41 => 'Can\'t uncompress compressed response', //CURLE_FUNCTION_NOT_FOUND
226-
51 => 'Could not connect to host', //CURLE_PEER_FAILED_VERIFICATION
227-
52 => 'Error Fetching http body, No Content-Length, connection closed or chunked data', //CURLE_GOT_NOTHING
228-
53 => 'SSL support is not available in this build', //CURLE_SSL_ENGINE_NOTFOUND
229-
54 => 'SSL support is not available in this build', //CURLE_SSL_ENGINE_SETFAILED
230-
55 => 'Failed Sending HTTP SOAP request', //CURLE_SEND_ERROR
231-
56 => 'Error Fetching http body, No Content-Length, connection closed or chunked data', //CURLE_RECV_ERROR
232-
58 => 'Could not connect to host', //CURLE_SSL_CERTPROBLEM
233-
59 => 'Could not connect to host', //CURLE_SSL_CIPHER
234-
60 => 'Could not connect to host', //CURLE_SSL_CACERT
235-
61 => 'Unknown Content-Encoding', //CURLE_BAD_CONTENT_ENCODING
236-
65 => 'Failed Sending HTTP SOAP request', //CURLE_SEND_FAIL_REWIND
237-
66 => 'SSL support is not available in this build', //CURLE_SSL_ENGINE_INITFAILED
238-
67 => 'Could not connect to host', //CURLE_LOGIN_DENIED
239-
77 => 'Could not connect to host', //CURLE_SSL_CACERT_BADFILE
240-
80 => 'Error Fetching http body, No Content-Length, connection closed or chunked data', //CURLE_SSL_SHUTDOWN_FAILED
217+
1 => 'Unknown protocol. Only http and https are allowed. (CURLE_UNSUPPORTED_PROTOCOL)',
218+
3 => 'Unable to parse URL (CURLE_URL_MALFORMAT)',
219+
5 => 'Could not connect to host (CURLE_COULDNT_RESOLVE_PROXY)',
220+
6 => 'Could not connect to host (CURLE_COULDNT_RESOLVE_HOST)',
221+
7 => 'Could not connect to host (CURLE_COULDNT_CONNECT)',
222+
9 => 'Could not connect to host (CURLE_REMOTE_ACCESS_DENIED)',
223+
28 => 'Failed Sending HTTP SOAP request (CURLE_OPERATION_TIMEDOUT)',
224+
35 => 'Could not connect to host (CURLE_SSL_CONNECT_ERROR)',
225+
41 => 'Can\'t uncompress compressed response (CURLE_FUNCTION_NOT_FOUND)',
226+
51 => 'Could not connect to host (CURLE_PEER_FAILED_VERIFICATION)',
227+
52 => 'Error Fetching http body, No Content-Length, connection closed or chunked data (CURLE_GOT_NOTHING)',
228+
53 => 'SSL support is not available in this build (CURLE_SSL_ENGINE_NOTFOUND)',
229+
54 => 'SSL support is not available in this build (CURLE_SSL_ENGINE_SETFAILED)',
230+
55 => 'Failed Sending HTTP SOAP request (CURLE_SEND_ERROR)',
231+
56 => 'Error Fetching http body, No Content-Length, connection closed or chunked data (CURLE_RECV_ERROR)',
232+
58 => 'Could not connect to host (CURLE_SSL_CERTPROBLEM)',
233+
59 => 'Could not connect to host (CURLE_SSL_CIPHER)',
234+
60 => 'Could not connect to host (CURLE_SSL_CACERT)',
235+
61 => 'Unknown Content-Encoding (CURLE_BAD_CONTENT_ENCODING)',
236+
65 => 'Failed Sending HTTP SOAP request (CURLE_SEND_FAIL_REWIND)',
237+
66 => 'SSL support is not available in this build (CURLE_SSL_ENGINE_INITFAILED)',
238+
67 => 'Could not connect to host (CURLE_LOGIN_DENIED)',
239+
77 => 'Could not connect to host (CURLE_SSL_CACERT_BADFILE)',
240+
80 => 'Error Fetching http body, No Content-Length, connection closed or chunked data (CURLE_SSL_SHUTDOWN_FAILED)',
241241
);
242242
}
243243

src/BeSimple/SoapClient/Tests/CurlTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ public function testGetErrorMessage()
3636
));
3737

3838
$curl->exec('http://unknown/curl.txt');
39-
$this->assertEquals('Could not connect to host', $curl->getErrorMessage());
39+
$this->assertEquals('Could not connect to host (CURLE_COULDNT_RESOLVE_HOST)', $curl->getErrorMessage());
4040

4141
$curl->exec(sprintf('xyz://localhost:%d/@404.txt', WEBSERVER_PORT));
42-
$this->assertEquals('Unknown protocol. Only http and https are allowed.', $curl->getErrorMessage());
42+
$this->assertEquals('Unknown protocol. Only http and https are allowed. (CURLE_UNSUPPORTED_PROTOCOL)', $curl->getErrorMessage());
4343

4444
$curl->exec('');
45-
$this->assertEquals('Unable to parse URL', $curl->getErrorMessage());
45+
$this->assertEquals('Unable to parse URL (CURLE_URL_MALFORMAT)', $curl->getErrorMessage());
4646
}
4747

4848
public function testGetRequestHeaders()

0 commit comments

Comments
 (0)