Add error handling for commands