feat(AWS DynamoDB Node): Improve error handling (#3661)

Co-authored-by: Jan Oberhauser <janober@users.noreply.github.com>
This commit is contained in:
Michael Kret 2022-07-10 13:16:34 +03:00 committed by GitHub
parent 8999403228
commit ce06d9bb3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,7 +59,10 @@ export async function awsApiRequest(this: IHookFunctions | IExecuteFunctions | I
try {
return JSON.parse(await this.helpers.request!(options));
} catch (error) {
const errorMessage = (error.response && error.response.body && error.response.body.message) || (error.response && error.response.body && error.response.body.Message) || error.message;
const errorMessage =
(error.response && error.response.body && error.response.body.message) ||
(error.response && error.response.body && error.response.body.Message) ||
error.message;
if (error.statusCode === 403) {
if (errorMessage === 'The security token included in the request is invalid.') {
throw new Error('The AWS credentials are not valid!');