@kaspernj/api-maker 1.0.370 → 1.0.372

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaspernj/api-maker",
3
- "version": "1.0.370",
3
+ "version": "1.0.372",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "index.js",
@@ -37,6 +37,7 @@
37
37
  "replaceall": ">= 0.1.6",
38
38
  "set-state-compare": "^1.0.42",
39
39
  "spark-md5": "^3.0.2",
40
+ "stacktrace-parser": "^0.1.10",
40
41
  "strftime": ">= 0.10.0",
41
42
  "uniqunize": "^1.0.1",
42
43
  "wake-event": ">= 0.0.1"
@@ -53,6 +53,8 @@ export default class ApiMakerCommandsPool {
53
53
  }
54
54
 
55
55
  addCommand(data) {
56
+ const stack = Error().stack
57
+
56
58
  return new Promise((resolve, reject) => {
57
59
  const id = this.currentId
58
60
  this.currentId += 1
@@ -61,7 +63,7 @@ export default class ApiMakerCommandsPool {
61
63
  const commandName = data.command
62
64
  const collectionName = data.collectionName
63
65
 
64
- this.pool[id] = {resolve, reject}
66
+ this.pool[id] = {resolve, reject, stack}
65
67
 
66
68
  if (!this.poolData[commandType]) this.poolData[commandType] = {}
67
69
  if (!this.poolData[commandType][collectionName]) this.poolData[commandType][collectionName] = {}
@@ -154,7 +156,11 @@ export default class ApiMakerCommandsPool {
154
156
  if (responseType == "success") {
155
157
  commandData.resolve(commandResponseData)
156
158
  } else if (responseType == "error") {
157
- commandData.reject(new CustomError("Command error", {response: commandResponseData}))
159
+ const error = new CustomError("Command error", {response: commandResponseData})
160
+
161
+ error.stack += commandData.stack
162
+
163
+ commandData.reject(error)
158
164
  } else if (responseType == "failed") {
159
165
  this.handleFailedResponse(commandData, commandResponseData)
160
166
  } else {