aandrew-me / tgpt

AI Chatbots in terminal without needing API keys

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Write errors to stderr, exit with error codes

niutech opened this issue · comments

In many places in functions.go there are error handling methods like:

fmt.Println("\nSome error has occurred.")
fmt.Println("Error:", err)
os.Exit(0)

Instead of writing to stdout, output them to stderr, like fmt.Fprintln(os.Stderr, "\nSome error has occurred.") or just println("\nSome error has occurred.").
Finally, exit with code bigger than 0, because 0 is reserved for success.

You're right