---
source: crates/ruff/src/rules/flake8_bugbear/mod.rs
---
B014.py:17:8: B014 [*] Exception handler with duplicate exception: `OSError`
   |
17 | try:
18 |     pass
19 | except (OSError, OSError) as err:
   |        ^^^^^^^^^^^^^^^^^^ B014
20 |     # Duplicate exception types are useless
21 |     pass
   |
   = help: De-duplicate exceptions

ℹ Suggested fix
14 14 | 
15 15 | try:
16 16 |     pass
17    |-except (OSError, OSError) as err:
   17 |+except OSError as err:
18 18 |     # Duplicate exception types are useless
19 19 |     pass
20 20 | 

B014.py:28:8: B014 [*] Exception handler with duplicate exception: `MyError`
   |
28 | try:
29 |     pass
30 | except (MyError, MyError):
   |        ^^^^^^^^^^^^^^^^^^ B014
31 |     # Detect duplicate non-builtin errors
32 |     pass
   |
   = help: De-duplicate exceptions

ℹ Suggested fix
25 25 | 
26 26 | try:
27 27 |     pass
28    |-except (MyError, MyError):
   28 |+except MyError:
29 29 |     # Detect duplicate non-builtin errors
30 30 |     pass
31 31 | 

B014.py:49:8: B014 [*] Exception handler with duplicate exception: `re.error`
   |
49 | try:
50 |     pass
51 | except (re.error, re.error):
   |        ^^^^^^^^^^^^^^^^^^^^ B014
52 |     # Duplicate exception types as attributes
53 |     pass
   |
   = help: De-duplicate exceptions

ℹ Suggested fix
46 46 | 
47 47 | try:
48 48 |     pass
49    |-except (re.error, re.error):
   49 |+except re.error:
50 50 |     # Duplicate exception types as attributes
51 51 |     pass
52 52 | 


