Not so easy you think. You should take in consideration all the cases, for example when the document exists, but you can not see it, because you do not have grants for it. In this case it will be raised the same type of exception.
Thinking more on it, the feature should be implemented at least in two levels, API and UI level. Here the question will be create a method for uploading document with a boolean ( overwrite when exists ). From UI should be set a checkbox to enable this feature or enable always from profiles ( I do not like much this scenario, because it can be a mistake ).
Also take in mind this feature goes agains check-out / check-in model ... consider this model is implemented by everybody, why, because you want to prevent the scenario two users apply changes at same time in a document and you are overwritten the changes done by another user ( typical scenario when sharing files from a network ).
The bulk upload feature from professional version ( when you are uploading a lot of files at the same time, with drag & drop feature, have something similar you are talking about, basically notice when document yet exists and ask you to overwrite, but from UI scenario will be better is you marked it before ).
Finally take in mind Automation classes sometimes apply changes on fly with documents ( like rename, move etc... ). Automation also might be used to intercept document creation, check if document exists or not, and in case exist work as an update ( not easy implementation ).