Skip to content

Critical error when payload is too big #370

@furstenheim

Description

@furstenheim

Issue Summary

If the payload is too large Sendgrid's API returns the following HTML

 <html>
 <head><title>413 Request Entity Too Large</title></head>
 <body bgcolor="white"> 
 <center><h1>413 Request Entity Too Large</h1></center>
 <hr><center>nginx</center>
 </body>
 </html>

This messes up with a JSON.parse which raises a global exception

Steps to Reproduce

The least the method sendgrid.API should reject the promise instead of raising a global error.
I'd say that ideally the API would return a json with an error element and this would make the method reject the promise with the corresponding error

Technical details:

  • sendgrid-nodejs Version: 4.x.x
  • Node.js Version: 4.1.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions