A mistake is wrong because the outcome is found to be wrong. Mistakes are made when a free choice is made, and later called "mistakes" when they score badly in the context of the goal of determining a particular answer, or else they simply turn out to be bad choices in some later assessment.
Errors, on the other hand, are made with reference to some ideal code, model, or set of rules that would have dictated a different action. The action was wrong because it was different from the "right" or normal one under the circumstances.