---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
---
UP024 [*] Replace aliased errors with `OSError`
  --> UP024_4.py:9:8
   |
 7 |     conn.ensure_connection(max_retries=2)
 8 |     conn._close()
 9 | except (socket.error, exceptions.OperationalError):
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10 |     return HttpResponseServerError("cache: cannot connect to broker.")
   |
help: Replace with builtin `OSError`
   |
8  |     conn._close()
   - except (socket.error, exceptions.OperationalError):
9  + except (OSError, exceptions.OperationalError):
10 |     return HttpResponseServerError("cache: cannot connect to broker.")
   |
