Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ginger.io/beyonce

Package Overview
Dependencies
Maintainers
26
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ginger.io/beyonce - npm Package Compare versions

Comparing version 0.0.62 to 0.0.63

28

dist/dynamo/operations/transactWriteItems.js

@@ -34,3 +34,29 @@ "use strict";

}));
yield client.transactWrite({ TransactItems: requests }).promise();
const response = client.transactWrite({ TransactItems: requests });
// If a transaction is cancelled (i.e. fails), the AWS sdk sticks the reasons in the response
// body, but not the exception. So when errors occur, we extract the reasons (if present)
// See: https://github.com/aws/aws-sdk-js/issues/2464#issuecomment-503524701
let transactionCancellationReasons;
response.on("extractError", ({ error, httpResponse }) => {
try {
if (error) {
const { CancellationReasons } = JSON.parse(httpResponse.body.toString());
if (CancellationReasons) {
transactionCancellationReasons = CancellationReasons;
}
}
}
catch (e) { } // no op
});
try {
yield response.promise();
}
catch (e) {
if (transactionCancellationReasons) {
throw new Error(`${e.message}. Cancellation Reasons: ${JSON.stringify(transactionCancellationReasons)}`);
}
else {
throw e;
}
}
});

@@ -37,0 +63,0 @@ }

2

package.json
{
"name": "@ginger.io/beyonce",
"version": "0.0.62",
"version": "0.0.63",
"description": "Type-safe DynamoDB query builder for TypeScript. Designed with single-table architecture in mind.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -36,3 +36,28 @@ import { DynamoDB } from "aws-sdk"

await client.transactWrite({ TransactItems: requests }).promise()
const response = client.transactWrite({ TransactItems: requests })
// If a transaction is cancelled (i.e. fails), the AWS sdk sticks the reasons in the response
// body, but not the exception. So when errors occur, we extract the reasons (if present)
// See: https://github.com/aws/aws-sdk-js/issues/2464#issuecomment-503524701
let transactionCancellationReasons: any[] | undefined
response.on("extractError", ({ error, httpResponse }) => {
try {
if (error) {
const { CancellationReasons } = JSON.parse(httpResponse.body.toString())
if (CancellationReasons) {
transactionCancellationReasons = CancellationReasons
}
}
} catch (e) {} // no op
})
try {
await response.promise()
} catch (e) {
if (transactionCancellationReasons) {
throw new Error(`${e.message}. Cancellation Reasons: ${JSON.stringify(transactionCancellationReasons)}`)
} else {
throw e
}
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc