8go / matrix-commander-rs

simple but convenient CLI-based Matrix client app for sending and receiving (in Rust)
GNU General Public License v3.0
79 stars 2 forks source link

Exit code doesn't reflect success and failure #50

Open amkay opened 1 year ago

amkay commented 1 year ago

Hi! First of all, thank you all for this great project. It has been a blast using it so far.

Unfortunately I ran into a problem when I tried to send a message that was apparently too big. Sending the message failed as it should and an error was reported but the process still terminated with exit code 0. This also happens if a network problem exists, e.g. when you're offline. I have no idea of Rust but I looked at the code and as far as I understand it this is the behavior for all actions.

This is highly problematic in regards to reliability if you want to send messages automatically, e.g. in a script, and therefore cannot determine if it was successful or not.

The process should at least terminate with something different than 0 if there was an error. Ideally there should be different exit codes for different types of errors, so that one can differentiate between a user error (like the message being too big) and non-user errors (like network problems, the Matrix instance having temporary problems, etc.).