Skip to content

Commit

Permalink
Fix remove command message formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
samr28 committed Oct 14, 2017
1 parent fe92915 commit a604ad2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/agenda.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ function rmByName(robot, value) {
return `Removed '${value}' successfully`;
}
function rmById(robot, id) {
id++;
if (id > getAgendaLength(robot)) {
console.log(new Error(`Value '${id}' is out of bounds of ${getAgendaLength(robot)}`));
return new Error(`There are only ${getAgendaLength(robot)}. But you tried to remove item #${id}.`);
}
removeBrainDataById(robot, id);
return `Removed #${id+1} successfully`;
removeBrainDataById(robot, id-1);
return `Removed #${id} successfully`;
}

function update(robot, id, value) {
Expand Down

0 comments on commit a604ad2

Please sign in to comment.