Update index.d.ts by bamtron5 · Pull Request #417 · sendgrid/sendgrid-nodejs · GitHub
Skip to content

Update index.d.ts#417

Closed
bamtron5 wants to merge 1 commit into
sendgrid:masterfrom
bamtron5:patch-2
Closed

Update index.d.ts#417
bamtron5 wants to merge 1 commit into
sendgrid:masterfrom
bamtron5:patch-2

Conversation

@bamtron5

@bamtron5 bamtron5 commented Aug 2, 2017

Copy link
Copy Markdown

Your docs insist that SendGrid class has an error and a response for parameters. Can we update this or correct the docs in some way? Seems like an error and response is pertinent. Thanks SendGrid.

self.client.API(request, function(response) {
    try {
      response.body = response.body ? JSON.parse(response.body) : response.body;
    } catch (e) {
      return callback(e)
    }
    if (isValidResponse(response)) {
      callback(null, response);
    }
    else {
      var error = new SendGridError('Response error');
      error.response = response;
      callback(error, response);
    }
  });

Your docs insist that `SendGrid` class has an error and a response for parameters.  Can we update this or correct the docs in some way?  Seems like an error and response is pertinent.  Thanks SendGrid.

```
self.client.API(request, function(response) {
    try {
      response.body = response.body ? JSON.parse(response.body) : response.body;
    } catch (e) {
      return callback(e)
    }
    if (isValidResponse(response)) {
      callback(null, response);
    }
    else {
      var error = new SendGridError('Response error');
      error.response = response;
      callback(error, response);
    }
  });
```
@thinkingserious thinkingserious added the status: code review request requesting a community code review or review from Twilio label Aug 2, 2017
@SendGridDX

SendGridDX commented Aug 2, 2017

Copy link
Copy Markdown

@thinkingserious

Copy link
Copy Markdown
Contributor

Thanks @bamtron5!

@spartan563, thoughts?

@notheotherben

Copy link
Copy Markdown
Contributor

Looking through it now 👍

@notheotherben

Copy link
Copy Markdown
Contributor

Looks like the type of the error object in this PR is incorrect, it should derive from Error (as you can see here).

I've spun up #418 to address this, however if @bamtron5 would prefer the commit credit, he's more than welcome to copy the changes.

@bamtron5

bamtron5 commented Aug 2, 2017

Copy link
Copy Markdown
Author

@bamtron5 bamtron5 closed this Aug 2, 2017
@bamtron5 bamtron5 deleted the patch-2 branch August 2, 2017 23:55
thinkingserious added a commit that referenced this pull request Aug 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: code review request requesting a community code review or review from Twilio

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants