coin-or / python-mip

Python-MIP: collection of Python tools for the modeling and solution of Mixed-Integer Linear programs
Eclipse Public License 2.0
527 stars 92 forks source link

Make exceptions and asserts specific #89

Closed jurasofish closed 4 years ago

jurasofish commented 4 years ago

Replaced a heap of raw Exceptions with more specific exceptions. This will allow users of the package to avoid catching broad Exception exceptions. Should be no issues with backwards compatibility as the new exceptions are also sub-classes of Exception. The exceptions I've replaced them with are somewhat subjective and definitely need a review.

Replacing assert statements will change the exceptions they generate from an AssertionError to something else. So, not strictly backwards compatible. However, I really don't think anyone would have been writing code that relied on catching the rare assertion errors.