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

Uncaught exceptions in decode #7

Open
koblas opened this issue Apr 22, 2021 · 0 comments
Open

Uncaught exceptions in decode #7

koblas opened this issue Apr 22, 2021 · 0 comments

Comments

@koblas
Copy link

koblas commented Apr 22, 2021

General information

  • SDK/Library version: 1.0.0
  • Node Version: Not important

Issue description

Was reviewing the code to see if the current SDK libraries would handle an error that the old REST SDK libraries had issues with. Found that the current library handles it worse than the old SDK.

The lines in question:

          response.on('end', () => {
            // .... lines removed
            if (response.statusCode >= 200 && response.statusCode <= 299) {
              resolve(this._parseResponse(body, response, formattedHeaders));
            } else {

As you can see if JSON.parse as called by the _parseResponse method were to throw, this would throw out of the stream handler and never resolve the promise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant