Many use these words interchangeably, which can be right for certain situations, but some would deem a particular word as more appropriate than the other.
As what has been said earlier, the context will dictate the proper usage. ‘Error’ and ‘mistake’ fall into the same category. Many say that ‘error’ is more severe. It is due to miscalculation and wrong judgment, that ‘mistake’, on the other hand, is less in gravity, as people normally make mistakes. However, there are also many people who will argue with this dissection.
It is highly acceptable to use ‘error’ in formal or technical contexts. In scientific or highly technical terms, the word ‘error’ is more suitable. In the world of computing and programming, ‘error’ is the more fitting term to indicate a mistake, or fault, particularly in coding and processes. ‘System Error’ sounds better than ‘System Mistake’, doesn’t it?
‘Mistake’, on the other hand, is used more in casual English conversation. Though ‘error’ may still be used in exchange, it will often sound unnatural, or technicalese. It would be awkward to say something like: “It was all an error. I am sorry!”, to your girlfriend. The more natural sounding statement would be: “It was all a mistake. I am sorry!”