Hello,
The following
spreadsheet is not public, so the query.send() request will throw an error 403 in the browser console.
But this error is not reported in the callback response parameter.
With a small script (at the end of this post), I get the following console log :
The
documentation says that
getReasons() can return the followings code :access_denied The user does not have permissions to access the data source.invalid_query The specified query has a syntax error.data_truncated One or more data rows that match the query selection were not returned due to output size limits. (warning).timeout The query did not respond within the expected time.
Here, in this case, we should get an access_denied message.
It's either a problem in the google spreadsheet visualization implementation, either the mechanism behind query.send() in visualization.
As you can see in the time-stamps, the error 403 got thrown just after the query, but query.send() wait until the timeout (30 sec by default) to kick back.
This problem now impacts
Awesome Table, where it is necessary to get the correct reason of failure to inform the users.
Thank you for your time,
Jean-Rémi Delteil, Awesome Table Team
ps : here is the script :
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script>
google.setOnLoadCallback(sendQuery);
function sendQuery(){
var query = new google.visualization.Query(queryString);
// send the query
console.time('Query DATA fetch');
query.send(handleQueryResponse);
}
function handleQueryResponse(response) {
console.timeEnd('Query DATA fetch');
console.log('isError : ' + response.isError());
console.log('hasWarning : ' + response.hasWarning());
console.log('getReasons : ' + response.getReasons());
console.log('getMessage : ' + response.getMessage());
console.log('getDetailedMessage : ' + response.getDetailedMessage());
}
</script>
</body>
</html>