Promote IncorrectExceptOrder.

However, we lose some results due to not considering builtin/stdlib types.
This commit is contained in:
Joe Farebrother
2025-07-17 11:08:56 +01:00
parent 963e028645
commit e42002e1d7
2 changed files with 19 additions and 14 deletions

View File

@@ -25,11 +25,11 @@ is a super class of <code>Error</code>.
<p>Reorganize the <code>except</code> blocks so that the more specific <code>except</code>
is defined first. Alternatively, if the more specific <code>except</code> block is
no longer required then it should be deleted.</p>
no longer required, then it should be deleted.</p>
</recommendation>
<example>
<p>In this example the <code>except Exception:</code> will handle <code>AttributeError</code> preventing the
<p>In the following example, the <code>except Exception:</code> will handle <code>AttributeError</code> preventing the
subsequent handler from ever executing.</p>
<sample src="IncorrectExceptOrder.py" />
@@ -37,8 +37,8 @@ subsequent handler from ever executing.</p>
</example>
<references>
<li>Python Language Reference: <a href="http://docs.python.org/2.7/reference/compound_stmts.html#try">The try statement</a>,
<a href="http://docs.python.org/2.7/reference/executionmodel.html#exceptions">Exceptions</a>.</li>
<li>Python Language Reference: <a href="http://docs.python.org/3/reference/compound_stmts.html#try">The try statement</a>,
<a href="http://docs.python.org/3/reference/executionmodel.html#exceptions">Exceptions</a>.</li>
</references>