We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Manually creating promises for AWS SDK is not a good practice, and It does not throw all errors
Here is the recommended way for using promises ( And handling errors, too ), by the AWS SDK docs: Using JS Promises with AWS SDK
Here is an example updating the createTemplate function:
createTemplate
From:
await new Promise((resolve, reject) => { //do async AWS createTemplate ses.createTemplate(params, function (err, data) { if (err) { reject(err); } else { resolve(data); } }); }).then(response.send(200, 'Created')).catch(err => { response.status(500); response.send(err); });
To:
await new Promise((resolve, reject) => { try { ses.createTemplate(params).promise(); response.status(200).send("Created"); } catch (error) { response.status(500).send(error.message ?? "Error creating template"); } });
===> This is the recommended way, and it is required for Unit testing of error handling, issue #4
The text was updated successfully, but these errors were encountered:
@hammady
Sorry, something went wrong.
No branches or pull requests
Manually creating promises for AWS SDK is not a good practice, and It does not throw all errors
Here is the recommended way for using promises ( And handling errors, too ), by the AWS SDK docs:
Using JS Promises with AWS SDK
Here is an example updating the
createTemplate
function:From:
To:
===> This is the recommended way, and it is required for Unit testing of error handling, issue #4
The text was updated successfully, but these errors were encountered: