We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The exception thrown by CartoDBClient::runSql() doesn't return a valid message string, at least when the error is a SQL error.
In that case, the CartoDB response is an array, which runSql() tries to concatenate onto the Exception message.
Suggest testing for HTTP response 400 and adjusting the error message accordingly.
Will follow with patch, rolled against HEAD, relative to cartodbclient-php directory.
The text was updated successfully, but these errors were encountered:
Patch:
diff --git a/cartodb.class.php b/cartodb.class.php index a970857..7a87457 100644 --- a/cartodb.class.php +++ b/cartodb.class.php @@ -102,8 +102,17 @@ class CartoDBClient { $params = array('q' => $sql); $response = $this->request('sql', 'POST', array('params' => $params)); - if ($response['info']['http_code'] != 200) { - throw new Exception('There was a problem with your request: ' . $response['return']); + if ($response['info']['http_code'] == 400) { + throw new Exception( + 'There was a problem with your request: ' . $response['return']['error'][0], + $response['info']['http_code'] + ); + } + elseif ($response['info']['http_code'] != 200) { + throw new Exception( + 'There was a problem with your request: ' . $response['return'], + $response['info']['http_code'] + ); } return $response; }
Sorry, something went wrong.
No branches or pull requests
The exception thrown by CartoDBClient::runSql() doesn't return a valid message string, at least when the error is a SQL error.
In that case, the CartoDB response is an array, which runSql() tries to concatenate onto the Exception message.
Suggest testing for HTTP response 400 and adjusting the error message accordingly.
Will follow with patch, rolled against HEAD, relative to cartodbclient-php directory.
The text was updated successfully, but these errors were encountered: