3 ms·
If the file being already 500G is not an error condition, it shouldn't generate an error. Just like a package management operation (refresh software index, remo
by selfhoster11 5y ago
If the file being already 500G is not an error condition, it shouldn't generate an error. Just like a package management operation (refresh software index, remove or add a package) is idempotent, and will just do nothing if the conditions are already met.
To address the broader question: it really depends. A command is basically a function, but systemwide: you get to pick whether it's a pure function or whether it has side effects, or whether it's idempotent. Don't emit excessive errors, but don't hide them either.
- BizarroLand 5y agoPlus, that's edge case 101 checking to see if the thing you're going to change is already what you want it to be, so if the software had been properly tested at all it would provide the same end result (although possibly with a different completion message).