psdev-task-manager 1.0.9 → 1.0.11
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/backend/index.js
CHANGED
package/backend/tasks/index.js
CHANGED
|
@@ -9,8 +9,8 @@ const TASKS = {
|
|
|
9
9
|
if (data.retries){
|
|
10
10
|
error = task.error ? Number(task.error) - 1 : data.retries - 1;
|
|
11
11
|
}
|
|
12
|
-
if (data.shouldFail && (
|
|
13
|
-
throw new Error(error
|
|
12
|
+
if (data.shouldFail && (error == null || error > 0)){
|
|
13
|
+
throw new Error(error != null ? error.toString() : 'Test error');
|
|
14
14
|
}
|
|
15
15
|
return 'test';
|
|
16
16
|
},
|
package/backend/tasks/utils.js
CHANGED
|
@@ -82,6 +82,9 @@ const updateTask = async task => {
|
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
84
|
const markTask = async ({ task, status, error, amountOfRetries }) => {
|
|
85
|
+
if (!task || typeof task !== 'object') {
|
|
86
|
+
throw new Error('[markTask] Invalid task object provided');
|
|
87
|
+
}
|
|
85
88
|
const toMarkTask = {
|
|
86
89
|
...task,
|
|
87
90
|
...(status && { status }),
|