aboutsummaryrefslogtreecommitdiffstats
path: root/bots/todo-js/tools.js
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-06-10 19:57:37 +0800
committerGitHub <noreply@github.com>2024-06-10 19:57:37 +0800
commit7225ee331a82cf1f8d8afab8923c4f35a792e5b8 (patch)
tree7166211462ff174b6d9701e80b2200b8f52f3e41 /bots/todo-js/tools.js
parent8f3385ca9e87f6941914953cabe8ed1e325305cb (diff)
downloadllm-functions-docker-7225ee331a82cf1f8d8afab8923c4f35a792e5b8.tar.gz
refactor: improve bots/todo-* (#41)
Diffstat (limited to 'bots/todo-js/tools.js')
-rw-r--r--bots/todo-js/tools.js9
1 files changed, 2 insertions, 7 deletions
diff --git a/bots/todo-js/tools.js b/bots/todo-js/tools.js
index ed3ed39..0c9db49 100644
--- a/bots/todo-js/tools.js
+++ b/bots/todo-js/tools.js
@@ -34,7 +34,7 @@ exports.del_todo = function delTodo(args) {
fs.writeFileSync(todosFile, JSON.stringify(newData));
console.log(`Successfully deleted todo id=${args.id}`);
} else {
- _die('Empty todo list');
+ console.log('Empty todo list');
}
}
@@ -46,7 +46,7 @@ exports.list_todos = function listTodos() {
if (fs.existsSync(todosFile)) {
console.log(fs.readFileSync(todosFile, "utf8"));
} else {
- _die('Empty todo list');
+ console.log("[]");
}
}
@@ -66,8 +66,3 @@ function _getTodosFile() {
}
return path.join(cacheDir, 'todos.json');
}
-
-function _die(message) {
- console.error(message);
- process.exit(1);
-} \ No newline at end of file