@openstax/ts-utils 1.15.2 → 1.15.3

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.
@@ -4,6 +4,7 @@ exports.dynamoUnversionedDocumentStore = void 0;
4
4
  const client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
5
5
  const __1 = require("../../..");
6
6
  const config_1 = require("../../../config");
7
+ const errors_1 = require("../../../errors");
7
8
  const guards_1 = require("../../../guards");
8
9
  const dynamoEncoding_1 = require("../dynamoEncoding");
9
10
  const dynamodb = (0, __1.once)(() => new client_dynamodb_1.DynamoDB({ apiVersion: '2012-08-10' }));
@@ -62,7 +63,7 @@ const dynamoUnversionedDocumentStore = (initializer) => () => (configProvider) =
62
63
  var _a;
63
64
  const result = (_a = item.Attributes) === null || _a === void 0 ? void 0 : _a[field]['N'];
64
65
  if (!result) {
65
- throw new Error(`Item with ${key} "${id}" does not exist`);
66
+ throw new errors_1.NotFoundError(`Item with ${key} "${id}" does not exist`);
66
67
  }
67
68
  return parseFloat(result);
68
69
  });
@@ -31,6 +31,7 @@ const fsModule = __importStar(require("fs"));
31
31
  const path_1 = __importDefault(require("path"));
32
32
  const __1 = require("../../..");
33
33
  const config_1 = require("../../../config");
34
+ const errors_1 = require("../../../errors");
34
35
  const guards_1 = require("../../../guards");
35
36
  const fileSystemUnversionedDocumentStore = (initializer) => () => (configProvider) => (_, hashKey) => {
36
37
  const tableName = (0, config_1.resolveConfigValue)(configProvider[initializer.configSpace || 'fileSystem'].tableName);
@@ -101,7 +102,7 @@ const fileSystemUnversionedDocumentStore = (initializer) => () => (configProvide
101
102
  await mkTableDir;
102
103
  const data = await load(filename);
103
104
  if (!data) {
104
- throw new Error(`Item with ${hashKey.toString()} "${id}" does not exist`);
105
+ throw new errors_1.NotFoundError(`Item with ${hashKey.toString()} "${id}" does not exist`);
105
106
  }
106
107
  const newItem = { ...data, ...item };
107
108
  return new Promise((resolve, reject) => {