redis-time-series-ts
Version:
Javascript RedisTimeSeries client
22 lines (21 loc) • 715 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CommandReceiver = void 0;
class CommandReceiver {
constructor(client) {
this.client = client;
}
executeCommand(commandData) {
return new Promise(resolve => {
const command = commandData.commandFunction;
resolve(command.call(this.client, ...commandData.commandParams));
})
.then(res => {
return res;
})
.catch(err => {
throw new Error(`error when executing command "${commandData.commandName} ${commandData.commandParams.join(" ")}": ${err.message}`);
});
}
}
exports.CommandReceiver = CommandReceiver;