awslabs / aws-crt-nodejs

NodeJS bindings for the AWS Common Runtime.
Apache License 2.0
40 stars 27 forks source link

Validate the input types in the main operations in MQTT311 #459

Closed TwistedTwigleg closed 1 year ago

TwistedTwigleg commented 1 year ago

Description of changes:

Adds conditions to make sure the input data types passed in the main MQTT311 operations (publish, subscribe, unsubscribe) are the correct data types and, if they are not, returns an error stating the issue. While this is done automatically and not needed for Typescript, for pure Javascript it can be easy to accidentally pass the wrong type and, when this happens, the error returned doesn't make it completely clear what is going on. This PR makes it where if an incorrect datatype is passed, a rejected promise is returned.

Closes https://github.com/awslabs/aws-crt-nodejs/issues/460


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

TwistedTwigleg commented 1 year ago

Thanks! Merging into main...