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 handling is broken with 0.4.2 #78

Closed
proppy opened this issue Aug 10, 2013 · 4 comments
Closed

error handling is broken with 0.4.2 #78

proppy opened this issue Aug 10, 2013 · 4 comments
Assignees
Labels
🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@proppy
Copy link
Contributor

proppy commented Aug 10, 2013

Given the following HTTP response:

400 Bad Request

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "INVALID_ARGUMENT",
    "message": "one of fields Query.query and Query.gql_query must be set",
    "debugInfo": "..."
   }
  ],
  "code": 400,
  "message": "one of fields Query.query and Query.gql_query must be set"
 }
}

0.4.2 calls the method callback with:

err: null
result: 'one of fields Query.query and Query.gql_query must be set'

While 0.2.13-alpha called it with:

err: { code: 400,
  message: 'one of fields Query.query and Query.gql_query must be set',
  data:
   [ { domain: 'global',
       reason: 'INVALID_ARGUMENT',
       message: 'one of fields Query.query and Query.gql_query must be set' } ] }
result: undefined
@rakyll
Copy link
Contributor

rakyll commented Aug 10, 2013

Could you add a snippet for me to reproduce?

@proppy
Copy link
Contributor Author

proppy commented Aug 13, 2013

var googleapis = require('googleapis');
var datasetId = process.argv[2];
var compute = new googleapis.auth.Compute();
compute.authorize(function(err) {
    googleapis.discover('datastore', 'v1beta1')
        .withAuthClient(compute)
        .execute(function(err, client) {
            var datastore = client.datastore.datasets;
            datastore.runQuery({
                datasetId: datasetId
            }).execute(function(err, result) {
                console.log(err, result);
                console.assert(err, 'err should not be null');
                console.assert(!result, 'result should be undefined');
            });
    });
});

@rakyll
Copy link
Contributor

rakyll commented Aug 13, 2013

requests was force trying to parse the responses to a JSON object with the prev version's options. #79 should be fixing your issue.

@rakyll rakyll closed this as completed Aug 13, 2013
@proppy
Copy link
Contributor Author

proppy commented Aug 13, 2013

This indeed fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants