Better error handling in cli