Skip to content

Callback error should be an Error instance, not a plain object #345

@sindresorhus

Description

@sindresorhus

That is the Node convention and the expected output.

See: GoogleChromeLabs/psi#43

Test-case

var googleapis = require('googleapis');
var pagespeed = googleapis.pagespeedonline('v1').pagespeedapi.runpagespeed;

// intentional grammar mistake to trigger the error
pagespeed({url: 'http://google.con'}, function (err, response) {
  if (err) {
    throw err;
    //=> [object Object]
  }
});

It should throw the error with stack, but instead just throws [object Object].

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.triage meI really want to be triaged.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions