Added error handler
gitea/salix/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
Joan Sanchez 2020-02-28 08:24:01 +01:00
parent a8eea3d8f6
commit b0779fb2d3
1 changed files with 4 additions and 0 deletions

View File

@ -26,6 +26,10 @@ module.exports = Self => {
Self.sendCheckingPresence = async(ctx, workerId, message) => {
const models = Self.app.models;
const account = await models.Account.findById(workerId);
const userId = ctx.req.accessToken.userId;
if (!account)
throw new Error(`Could not send message to worker id ${workerId} from user ${userId}`);
const query = `SELECT worker_isWorking(?) isWorking`;
const [result] = await Self.rawSql(query, [workerId]);