core-services-sdk 1.2.3 → 1.2.4

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.js ADDED
@@ -0,0 +1,3 @@
1
+ import { HttpError } from './src/index.js'
2
+
3
+ throw new HttpError({ code: '2', httpStatusCode: 22 })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "core-services-sdk",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "main": "src/index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -48,15 +48,17 @@ export const initializeMongoDb = async ({ config, collectionNames = {} }) => {
48
48
 
49
49
  const withTransaction = async (action) => {
50
50
  const session = client.startSession()
51
+ let actionResponse
51
52
  try {
52
53
  session.startTransaction()
53
- await action({ session })
54
+ actionResponse = await action({ session })
54
55
  await session.commitTransaction()
55
56
  } catch (error) {
56
57
  await session.abortTransaction()
57
58
  throw error
58
59
  } finally {
59
60
  await session.endSession()
61
+ return actionResponse
60
62
  }
61
63
  }
62
64