throw std::exception on invalid opcode

fix to use custom exception