mhammond / pywin32

Python for Windows (pywin32) Extensions
4.9k stars 783 forks source link

Replace strings by actual Exception subclasses #2270

Closed Avasam closed 3 weeks ago

Avasam commented 1 month ago

Fixes #1902

There's a few attempted approaches on a case-by-case scenario. You'll need to open the full files to find where raise error( is called.

As a general question, should we try to replace them all with direct exception calls? (RuntimeError, TypeError, ValueError, pywintypes.error, COMException, ...), or should new module-specific exceptions be created?

Same question as in #2269 : Should they still be accessible with a deprecation warning ? Or is it ok to remove them?

(no changelog entry yet as the decision for a solution isn't final)