electrodb 2.10.3 → 2.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +3 -2
- package/library-data.json +9152 -0
- package/package.json +1 -1
- package/src/entity.js +17 -10
package/package.json
CHANGED
package/src/entity.js
CHANGED
|
@@ -494,7 +494,7 @@ class Entity {
|
|
|
494
494
|
async go(method, parameters = {}, config = {}) {
|
|
495
495
|
let stackTrace;
|
|
496
496
|
if (!config.originalErr) {
|
|
497
|
-
stackTrace = new e.ElectroError(e.ErrorCodes.AWSError);
|
|
497
|
+
stackTrace = new e.ElectroError(e.ErrorCodes.AWSError).stack;
|
|
498
498
|
}
|
|
499
499
|
try {
|
|
500
500
|
switch (method) {
|
|
@@ -513,12 +513,13 @@ class Entity {
|
|
|
513
513
|
return Promise.reject(err);
|
|
514
514
|
} else {
|
|
515
515
|
if (err.__isAWSError) {
|
|
516
|
-
|
|
516
|
+
const error = new e.ElectroError(
|
|
517
517
|
e.ErrorCodes.AWSError,
|
|
518
518
|
`Error thrown by DynamoDB client: "${err.message}"`,
|
|
519
519
|
err,
|
|
520
|
-
)
|
|
521
|
-
|
|
520
|
+
);
|
|
521
|
+
error.stack = stackTrace;
|
|
522
|
+
return Promise.reject(error);
|
|
522
523
|
} else if (err.isElectroError) {
|
|
523
524
|
return Promise.reject(err);
|
|
524
525
|
} else {
|
|
@@ -925,7 +926,7 @@ class Entity {
|
|
|
925
926
|
formatResponse(response, index, config = {}) {
|
|
926
927
|
let stackTrace;
|
|
927
928
|
if (!config.originalErr) {
|
|
928
|
-
stackTrace = new e.ElectroError(e.ErrorCodes.AWSError);
|
|
929
|
+
stackTrace = new e.ElectroError(e.ErrorCodes.AWSError).stack;
|
|
929
930
|
}
|
|
930
931
|
try {
|
|
931
932
|
let results = {};
|
|
@@ -1013,11 +1014,17 @@ class Entity {
|
|
|
1013
1014
|
|
|
1014
1015
|
return { data: results };
|
|
1015
1016
|
} catch (err) {
|
|
1016
|
-
if (config.originalErr || stackTrace === undefined) {
|
|
1017
|
+
if (config.originalErr || stackTrace === undefined || err.isElectroError) {
|
|
1017
1018
|
throw err;
|
|
1018
1019
|
} else {
|
|
1019
|
-
|
|
1020
|
-
|
|
1020
|
+
const error = new e.ElectroError(
|
|
1021
|
+
e.ErrorCodes.AWSError,
|
|
1022
|
+
err.message,
|
|
1023
|
+
err,
|
|
1024
|
+
);
|
|
1025
|
+
error.stack = stackTrace;
|
|
1026
|
+
|
|
1027
|
+
throw error;
|
|
1021
1028
|
}
|
|
1022
1029
|
}
|
|
1023
1030
|
}
|
|
@@ -2310,7 +2317,7 @@ class Entity {
|
|
|
2310
2317
|
// TODO: This will only work with root attributes and should be refactored for nested attributes.
|
|
2311
2318
|
update.set(attr.field, preparedUpdateValues[path]);
|
|
2312
2319
|
} else {
|
|
2313
|
-
// this could be fields added by electro that don't
|
|
2320
|
+
// this could be fields added by electro that don't appear in the schema
|
|
2314
2321
|
update.set(path, preparedUpdateValues[path]);
|
|
2315
2322
|
}
|
|
2316
2323
|
}
|
|
@@ -2362,7 +2369,7 @@ class Entity {
|
|
|
2362
2369
|
modifiedAttributeNames[primaryIndexAttribute] === undefined;
|
|
2363
2370
|
if (isNotTablePK && isNotTableSK && wasNotAlreadyModified) {
|
|
2364
2371
|
update.set(
|
|
2365
|
-
|
|
2372
|
+
attribute.field,
|
|
2366
2373
|
primaryIndexAttributes[primaryIndexAttribute],
|
|
2367
2374
|
);
|
|
2368
2375
|
}
|