Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error reporting is broken #73

Open
arnaud-lb opened this issue Jul 9, 2020 · 0 comments · May be fixed by #74
Open

Error reporting is broken #73

arnaud-lb opened this issue Jul 9, 2020 · 0 comments · May be fixed by #74

Comments

@arnaud-lb
Copy link

The HTTP transport will always return ["error" => "", "code" => 0] in case of network error. This makes debugging difficult.

At line 207 below, we check if $response is false, but it's always a string. In case of network error, it will be the empty string, json_decode() fails, and ["error" => "", "code" => 0] is returned.

curl_exec($conn);
$response = ob_get_clean();
if ($response !== false) {
$data = json_decode($response, true);
if (!$data) {
$data = array('error' => $response, "code" => curl_getinfo($conn, CURLINFO_HTTP_CODE));
}
}
else {

Using curl_geterrno() === 0 instead of $response !== false fixes the problem.

arnaud-lb added a commit to arnaud-lb/elasticsearch-1 that referenced this issue Jul 9, 2020
@arnaud-lb arnaud-lb linked a pull request Jul 9, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant