Archipelago/worlds/aquaria
Mysteryem d4b1351c99
Aquaria: Remove BaseException handling from create_item (#4218)
* Aquaria: Remove BaseException handling from create_item

Catching `BaseException` without re-raising the exception should almost
never be done because `BaseException` includes exit exceptions, such as
`SystemExit` and `KeyboardInterrupt`.

Ideally, the caught exception types should be as narrow as possible to
not mask bugs from catching unexpected exceptions. Having narrow
exception types can also help indicate to other developers what
exceptions are expected to be raisable by the code within the `try`
clause.

Similarly, the `try` clause should ideally contain the minimum code
necessary, to avoid masking bugs in the case that code within the `try`
clause that is not expected to raise an exception does so.

In this case, the only expected exception that can occur appears to be
`item_table[name]` that can raise a `KeyError` when `create_item()` is
passed an unexpected `name` argument. So this patch moves the other code
out of the `try` clause and changes the caught exception types to only
`KeyError`.

* Remove try-except

The KeyError that would be raised will be propagated as-is rather than
raising a new exception in its place.

* Remove extra newline

The original code did not have this newline, so it has been removed.
2024-11-21 20:43:37 +01:00
..
docs [Aquaria] Adds Poptracker Pack to the Aquaria Setup Guides (#4037) 2024-10-17 03:34:10 +02:00
test Aquaria: Fixing no progression bug (#4199) 2024-11-17 16:59:50 +01:00
Items.py Aquaria: Logic bug fixes (#3679) 2024-08-08 00:19:52 +02:00
Locations.py Aquaria: Logic bug fixes (#3679) 2024-08-08 00:19:52 +02:00
Options.py Aquaria: Renaming some locations for consistency (#3533) 2024-07-05 22:40:26 +02:00
Regions.py Aquaria: Fixing no progression bug (#4199) 2024-11-17 16:59:50 +01:00
__init__.py Aquaria: Remove BaseException handling from create_item (#4218) 2024-11-21 20:43:37 +01:00