Skip to content

Commit

Permalink
fix: use responder to send the error.
Browse files Browse the repository at this point in the history
  • Loading branch information
KeesCBakker committed Dec 11, 2024
1 parent 55b2c3f commit a485f16
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class Bot {
*/
sendError(message, context) {
context.robot.logger.error(message);
context.send(message);
this.adapter.responder.sendError(context, message);
}

/**
Expand Down
9 changes: 9 additions & 0 deletions src/adapters/Responder.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ class Responder {
send(res, title, image, link) {
res.send(`${title}: ${image} - ${link}`);
}

/**
* Sends the error message to Hubot.
* @param {Hubot.Response} res the context.
* @param {string} message the error message.
*/
sendError(res, message) {
res.send(message);
}
}

exports.Responder = Responder;

0 comments on commit a485f16

Please sign in to comment.