modify try..catch for precise invalid command errors