Skip to content

Commit

Permalink
feat(AWS DynamoDB Node): Improve error handling (#3661)
Browse files Browse the repository at this point in the history
Co-authored-by: Jan Oberhauser <[email protected]>
  • Loading branch information
michael-radency and janober authored Jul 10, 2022
1 parent 8999403 commit ce06d9b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/nodes-base/nodes/Aws/DynamoDB/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!');
Expand Down

0 comments on commit ce06d9b

Please sign in to comment.