---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
---
UP041 [*] Replace aliased errors with `TimeoutError`
 --> UP041.py:5:8
  |
3 | try:
4 |     pass
5 | except asyncio.TimeoutError:
  |        ^^^^^^^^^^^^^^^^^^^^
6 |     pass
  |
help: Replace `asyncio.TimeoutError` with builtin `TimeoutError`
  |
4 |     pass
  - except asyncio.TimeoutError:
5 + except TimeoutError:
6 |     pass
  |

UP041 [*] Replace aliased errors with `TimeoutError`
  --> UP041.py:10:8
   |
 8 | try:
 9 |     pass
10 | except socket.timeout:
   |        ^^^^^^^^^^^^^^
11 |     pass
   |
help: Replace `socket.timeout` with builtin `TimeoutError`
   |
9  |     pass
   - except socket.timeout:
10 + except TimeoutError:
11 |     pass
   |

UP041 [*] Replace aliased errors with `TimeoutError`
  --> UP041.py:17:8
   |
15 | try:
16 |     pass
17 | except (asyncio.TimeoutError,):
   |        ^^^^^^^^^^^^^^^^^^^^^^^
18 |     pass
   |
help: Replace with builtin `TimeoutError`
   |
16 |     pass
   - except (asyncio.TimeoutError,):
17 + except TimeoutError:
18 |     pass
   |

UP041 [*] Replace aliased errors with `TimeoutError`
  --> UP041.py:22:8
   |
20 | try:
21 |     pass
22 | except (socket.timeout,):
   |        ^^^^^^^^^^^^^^^^^
23 |     pass
   |
help: Replace with builtin `TimeoutError`
   |
21 |     pass
   - except (socket.timeout,):
22 + except TimeoutError:
23 |     pass
   |

UP041 [*] Replace aliased errors with `TimeoutError`
  --> UP041.py:27:8
   |
25 | try:
26 |     pass
27 | except (asyncio.TimeoutError, socket.timeout,):
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
28 |     pass
   |
help: Replace with builtin `TimeoutError`
   |
26 |     pass
   - except (asyncio.TimeoutError, socket.timeout,):
27 + except TimeoutError:
28 |     pass
   |

UP041 [*] Replace aliased errors with `TimeoutError`
  --> UP041.py:34:8
   |
32 | try:
33 |     pass
34 | except (asyncio.TimeoutError, socket.timeout, KeyError, TimeoutError):
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
35 |     pass
   |
help: Replace with builtin `TimeoutError`
   |
33 |     pass
   - except (asyncio.TimeoutError, socket.timeout, KeyError, TimeoutError):
34 + except (KeyError, TimeoutError):
35 |     pass
   |

UP041 [*] Replace aliased errors with `TimeoutError`
  --> UP041.py:42:8
   |
40 | try:
41 |     pass
42 | except (asyncio.TimeoutError, error):
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
43 |     pass
   |
help: Replace with builtin `TimeoutError`
   |
41 |     pass
   - except (asyncio.TimeoutError, error):
42 + except (TimeoutError, error):
43 |     pass
   |

UP041 [*] Replace aliased errors with `TimeoutError`
  --> UP041.py:72:5
   |
71 |   raise (
72 | /     asyncio.
73 | |     # text
74 | |        TimeoutError
   | |___________________^
75 |   )
   |
help: Replace `asyncio.TimeoutError` with builtin `TimeoutError`
   |
71 | raise (
   -     asyncio.
   -     # text
   -        TimeoutError
72 +     TimeoutError
73 | )
   |
note: This is an unsafe fix and may change runtime behavior
