@kaspernj/api-maker 1.0.371 → 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 +1 -1
- package/src/commands-pool.mjs +8 -2
package/package.json
CHANGED
package/src/commands-pool.mjs
CHANGED
|
@@ -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
|
-
|
|
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 {
|