This paper studies the error exponent of i.i.d. randomly generated codes used for transmission over discrete memoryless channels with maximum likelihood decoding. Specifically, this paper shows that the error exponent of a code, defined as the negative normalized logarithm of the probability of error, converges in probability to the typical error exponent. For high rates, the result is a consequence of the fact that the randomcoding error exponent and the sphere-packing error exponent coincide. For low rates, instead, the proof of convergence is based on the fact that the union bound accurately characterizes the probability of error.