== Why is this an issue?

Repeating an exception class in a single ``++except++`` statement will not fail but it is not what the developer intended. Either the class is not the one which should be caught, or this is dead code.


Having a subclass and a parent class in the same ``++except++`` statement is also useless. It is enough to keep only the parent class.


This rule raises an issue when an exception class is duplicated in an ``++except++`` statement, or when an exception class has a parent class in the same ``++except++`` statement.


=== Noncompliant code example

[source,python]
----
try:
    raise NotImplementedError()
except (NotImplementedError, RuntimeError):  # Noncompliant. NotImplementedError inherits from RuntimeError
    print("Foo")

try:
    raise NotImplementedError()
except (RuntimeError, RuntimeError):  # Noncompliant.
    print("Foo")
----


=== Compliant solution

[source,python]
----
try:
    raise NotImplementedError()
except RuntimeError:
    print("Foo")
----


== Resources

* Python Documentation - https://docs.python.org/3/tutorial/errors.html#handling-exceptions[Handling Exceptions]
ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::../message.adoc[]

include::../highlighting.adoc[]

endif::env-github,rspecator-view[]
