introduced new exception classes for structured error reporting

This commit is contained in:
zadam
2022-12-09 16:04:13 +01:00
parent eaf195e0c8
commit 342ae6e5e2
27 changed files with 123 additions and 64 deletions

View File

@@ -6,7 +6,7 @@ const ws = require('./ws');
const taskContexts = {};
class TaskContext {
constructor(taskId, taskType, data) {
constructor(taskId, taskType, data = null) {
this.taskId = taskId;
this.taskType = taskType;
this.data = data;
@@ -24,7 +24,7 @@ class TaskContext {
}
/** @returns {TaskContext} */
static getInstance(taskId, taskType, data) {
static getInstance(taskId, taskType, data = null) {
if (!taskContexts[taskId]) {
taskContexts[taskId] = new TaskContext(taskId, taskType, data);
}