Skip to content

Commit

Permalink
Fixes latency issue introduced in 2.10.4 affecting all queries disc… (
Browse files Browse the repository at this point in the history
#324)

* Fixes latency issue introduced in `2.10.4` affecting all queries discovered and brought forward by Ross Gerbasi. Thank you, Ross Gerbasi!

* Fixes test errors
  • Loading branch information
tywalch authored Nov 9, 2023
1 parent 94e6e54 commit c1bf486
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ All notable changes to this project will be documented in this file. Breaking ch
- Addresses edge case that filtered valid items when item lacked entity identifiers (created outside ElectroDB) when keys (pk or sk) were numeric.

## [2.10.4] - 2023-10-26
> NOTE: This version is depricated, this version introduced code that significantly increased latency. That code was fixed in `2.10.7`
### Added
- Adds `cause` property to `ElectroError`, currently populated when error originates from the AWS Client, to help with error triage. This also adds the ability to provide an error type to ElectroError<Error> to type the error located on `cause`.

Expand All @@ -480,4 +481,8 @@ All notable changes to this project will be documented in this file. Breaking ch

## [2.10.6] - 2023-11-04
### Fixed
- Addresses [Issue #321](https://github.com/tywalch/electrodb/issues/321), fixing expression attribute name and value formatting to remove non-alphanumeric and underscore characters.
- Addresses [Issue #321](https://github.com/tywalch/electrodb/issues/321), fixing expression attribute name and value formatting to remove non-alphanumeric and underscore characters.

## [2.10.7] - 2023-11-09
### Fixed
- Fixes latency issue introduced in `2.10.4` affecting all queries discovered and brought forward by Ross Gerbasi. Thank you, Ross Gerbasi!
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "electrodb",
"version": "2.10.6",
"version": "2.10.7",
"description": "A library to more easily create and interact with multiple entities and heretical relationships in dynamodb",
"main": "index.js",
"scripts": {
Expand Down
25 changes: 8 additions & 17 deletions src/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ class Entity {
async go(method, parameters = {}, config = {}) {
let stackTrace;
if (!config.originalErr) {
stackTrace = new e.ElectroError(e.ErrorCodes.AWSError).stack;
stackTrace = new e.ElectroError(e.ErrorCodes.AWSError);
}
try {
switch (method) {
Expand All @@ -513,13 +513,9 @@ class Entity {
return Promise.reject(err);
} else {
if (err.__isAWSError) {
const error = new e.ElectroError(
e.ErrorCodes.AWSError,
`Error thrown by DynamoDB client: "${err.message}"`,
err,
);
error.stack = stackTrace;
return Promise.reject(error);
stackTrace.message = `Error thrown by DynamoDB client: "${err.message}" - For more detail on this error reference: https://electrodb.dev/en/reference/errors/#aws-error`;
stackTrace.cause = err;
return Promise.reject(stackTrace);
} else if (err.isElectroError) {
return Promise.reject(err);
} else {
Expand Down Expand Up @@ -926,7 +922,7 @@ class Entity {
formatResponse(response, index, config = {}) {
let stackTrace;
if (!config.originalErr) {
stackTrace = new e.ElectroError(e.ErrorCodes.AWSError).stack;
stackTrace = new e.ElectroError(e.ErrorCodes.AWSError);
}
try {
let results = {};
Expand Down Expand Up @@ -1021,14 +1017,9 @@ class Entity {
) {
throw err;
} else {
const error = new e.ElectroError(
e.ErrorCodes.AWSError,
err.message,
err,
);
error.stack = stackTrace;

throw error;
stackTrace.message = `Error thrown by DynamoDB client: "${err.message}" - For more detail on this error reference: https://electrodb.dev/en/reference/errors/#aws-error`;
stackTrace.cause = err;
throw stackTrace;
}
}
}
Expand Down

0 comments on commit c1bf486

Please sign in to comment.