Error handeling in ProcessCommand function.