---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
---
UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:10:7
   |
 8 | # Testing the modules
 9 | import socket, mmap, select, resource
10 | raise socket.error
   |       ^^^^^^^^^^^^
11 | raise mmap.error
12 | raise select.error
   |
help: Replace `socket.error` with builtin `OSError`
   |
9  | import socket, mmap, select, resource
   - raise socket.error
10 + raise OSError
11 | raise mmap.error
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:11:7
   |
 9 | import socket, mmap, select, resource
10 | raise socket.error
11 | raise mmap.error
   |       ^^^^^^^^^^
12 | raise select.error
13 | raise resource.error
   |
help: Replace `mmap.error` with builtin `OSError`
   |
10 | raise socket.error
   - raise mmap.error
11 + raise OSError
12 | raise select.error
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:12:7
   |
10 | raise socket.error
11 | raise mmap.error
12 | raise select.error
   |       ^^^^^^^^^^^^
13 | raise resource.error
   |
help: Replace `select.error` with builtin `OSError`
   |
11 | raise mmap.error
   - raise select.error
12 + raise OSError
13 | raise resource.error
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:13:7
   |
11 | raise mmap.error
12 | raise select.error
13 | raise resource.error
   |       ^^^^^^^^^^^^^^
14 |
15 | raise socket.error()
   |
help: Replace `resource.error` with builtin `OSError`
   |
12 | raise select.error
   - raise resource.error
13 + raise OSError
14 |
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:15:7
   |
13 | raise resource.error
14 |
15 | raise socket.error()
   |       ^^^^^^^^^^^^
16 | raise mmap.error(1)
17 | raise select.error(1, 2)
   |
help: Replace `socket.error` with builtin `OSError`
   |
14 |
   - raise socket.error()
15 + raise OSError()
16 | raise mmap.error(1)
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:16:7
   |
15 | raise socket.error()
16 | raise mmap.error(1)
   |       ^^^^^^^^^^
17 | raise select.error(1, 2)
18 | raise resource.error(1, "strerror", "filename")
   |
help: Replace `mmap.error` with builtin `OSError`
   |
15 | raise socket.error()
   - raise mmap.error(1)
16 + raise OSError(1)
17 | raise select.error(1, 2)
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:17:7
   |
15 | raise socket.error()
16 | raise mmap.error(1)
17 | raise select.error(1, 2)
   |       ^^^^^^^^^^^^
18 | raise resource.error(1, "strerror", "filename")
   |
help: Replace `select.error` with builtin `OSError`
   |
16 | raise mmap.error(1)
   - raise select.error(1, 2)
17 + raise OSError(1, 2)
18 | raise resource.error(1, "strerror", "filename")
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:18:7
   |
16 | raise mmap.error(1)
17 | raise select.error(1, 2)
18 | raise resource.error(1, "strerror", "filename")
   |       ^^^^^^^^^^^^^^
19 |
20 | raise socket.error(
   |
help: Replace `resource.error` with builtin `OSError`
   |
17 | raise select.error(1, 2)
   - raise resource.error(1, "strerror", "filename")
18 + raise OSError(1, "strerror", "filename")
19 |
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:20:7
   |
18 | raise resource.error(1, "strerror", "filename")
19 |
20 | raise socket.error(
   |       ^^^^^^^^^^^^
21 |     1,
22 |     2,
   |
help: Replace `socket.error` with builtin `OSError`
   |
19 |
   - raise socket.error(
20 + raise OSError(
21 |     1,
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:27:7
   |
26 | from mmap import error
27 | raise error
   |       ^^^^^
28 |
29 | from socket import error
   |
help: Replace `error` with builtin `OSError`
   |
26 | from mmap import error
   - raise error
27 + raise OSError
28 |
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:30:7
   |
29 | from socket import error
30 | raise error(1)
   |       ^^^^^
31 |
32 | from select import error
   |
help: Replace `error` with builtin `OSError`
   |
29 | from socket import error
   - raise error(1)
30 + raise OSError(1)
31 |
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:33:7
   |
32 | from select import error
33 | raise error(1, 2)
   |       ^^^^^
34 |
35 | from resource import error
   |
help: Replace `error` with builtin `OSError`
   |
32 | from select import error
   - raise error(1, 2)
33 + raise OSError(1, 2)
34 |
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:36:7
   |
35 | from resource import error
36 | raise error(1, "strerror", "filename")
   |       ^^^^^
37 |
38 | # Testing the names
   |
help: Replace `error` with builtin `OSError`
   |
35 | from resource import error
   - raise error(1, "strerror", "filename")
36 + raise OSError(1, "strerror", "filename")
37 |
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:39:7
   |
38 | # Testing the names
39 | raise EnvironmentError
   |       ^^^^^^^^^^^^^^^^
40 | raise IOError
41 | raise WindowsError
   |
help: Replace `EnvironmentError` with builtin `OSError`
   |
38 | # Testing the names
   - raise EnvironmentError
39 + raise OSError
40 | raise IOError
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:40:7
   |
38 | # Testing the names
39 | raise EnvironmentError
40 | raise IOError
   |       ^^^^^^^
41 | raise WindowsError
   |
help: Replace `IOError` with builtin `OSError`
   |
39 | raise EnvironmentError
   - raise IOError
40 + raise OSError
41 | raise WindowsError
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:41:7
   |
39 | raise EnvironmentError
40 | raise IOError
41 | raise WindowsError
   |       ^^^^^^^^^^^^
42 |
43 | raise EnvironmentError()
   |
help: Replace `WindowsError` with builtin `OSError`
   |
40 | raise IOError
   - raise WindowsError
41 + raise OSError
42 |
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:43:7
   |
41 | raise WindowsError
42 |
43 | raise EnvironmentError()
   |       ^^^^^^^^^^^^^^^^
44 | raise IOError(1)
45 | raise WindowsError(1, 2)
   |
help: Replace `EnvironmentError` with builtin `OSError`
   |
42 |
   - raise EnvironmentError()
43 + raise OSError()
44 | raise IOError(1)
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:44:7
   |
43 | raise EnvironmentError()
44 | raise IOError(1)
   |       ^^^^^^^
45 | raise WindowsError(1, 2)
   |
help: Replace `IOError` with builtin `OSError`
   |
43 | raise EnvironmentError()
   - raise IOError(1)
44 + raise OSError(1)
45 | raise WindowsError(1, 2)
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:45:7
   |
43 | raise EnvironmentError()
44 | raise IOError(1)
45 | raise WindowsError(1, 2)
   |       ^^^^^^^^^^^^
46 |
47 | raise EnvironmentError(
   |
help: Replace `WindowsError` with builtin `OSError`
   |
44 | raise IOError(1)
   - raise WindowsError(1, 2)
45 + raise OSError(1, 2)
46 |
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:47:7
   |
45 | raise WindowsError(1, 2)
46 |
47 | raise EnvironmentError(
   |       ^^^^^^^^^^^^^^^^
48 |     1,
49 |     2,
   |
help: Replace `EnvironmentError` with builtin `OSError`
   |
46 |
   - raise EnvironmentError(
47 + raise OSError(
48 |     1,
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:53:7
   |
51 | )
52 |
53 | raise WindowsError
   |       ^^^^^^^^^^^^
54 | raise EnvironmentError(1)
55 | raise IOError(1, 2)
   |
help: Replace `WindowsError` with builtin `OSError`
   |
52 |
   - raise WindowsError
53 + raise OSError
54 | raise EnvironmentError(1)
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:54:7
   |
53 | raise WindowsError
54 | raise EnvironmentError(1)
   |       ^^^^^^^^^^^^^^^^
55 | raise IOError(1, 2)
   |
help: Replace `EnvironmentError` with builtin `OSError`
   |
53 | raise WindowsError
   - raise EnvironmentError(1)
54 + raise OSError(1)
55 | raise IOError(1, 2)
   |

UP024 [*] Replace aliased errors with `OSError`
  --> UP024_2.py:55:7
   |
53 | raise WindowsError
54 | raise EnvironmentError(1)
55 | raise IOError(1, 2)
   |       ^^^^^^^
   |
help: Replace `IOError` with builtin `OSError`
   |
54 | raise EnvironmentError(1)
   - raise IOError(1, 2)
55 + raise OSError(1, 2)
   |
