236 return JSONResponse({"error": "World not found"}, 404)
237 try:
238 await world.copy_to_server(dest_server, override=override)
239 except [IsADirectoryError, NotADirectoryError, OSError]:240 return JSONResponse({"message": "Failed to copy world, directory already exists"})
241 return JSONResponse({"message": "Copied world to server"}, 200)
242
236 return JSONResponse({"error": "World not found"}, 404)
237 try:
238 await world.copy_to_server(dest_server, override=override)
239 except [IsADirectoryError, NotADirectoryError, OSError]:240 return JSONResponse({"message": "Failed to copy world, directory already exists"})
241 return JSONResponse({"message": "Copied world to server"}, 200)
242
Two or more exceptions in the same exception handler clause that are identical or parts of the same inheritance hierarchy (i.e. overlapping). It is recommmend to refactor this.
class SomeException(Exception):
pass
class SubclassException(SomeException):
pass
try:
raise SubclassException()
except (SomeException, SubclassException):
pass
Here, SubclassException
has been derived from SomeException
, which makes it overlapping.
class SomeException(Exception):
pass
class SubclassException(SomeException):
pass
try:
raise SubclassException()
except SomeException:
pass