Skip to content

Commit 754df3e

Browse files
committed
refactor(process): narrow Compressor.propagate_stream catch to CompressorThermodynamicCalculationError
1 parent 2542e7b commit 754df3e

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/libecalc/process/process_units/compressor.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from typing import Final
22

3+
from libecalc.domain.process.compressor.core.exceptions import CompressorThermodynamicCalculationError
34
from libecalc.domain.process.compressor.core.train.utils.common import (
45
RECIRCULATION_BOUNDARY_TOLERANCE,
56
calculate_outlet_pressure_and_stream,
@@ -68,9 +69,9 @@ def propagate_stream(self, inlet_stream: FluidStream) -> FluidStream:
6869
inlet_stream=inlet_stream,
6970
fluid_service=self._fluid_service,
7071
)
71-
except Exception as exc:
72-
# Any exception from the EOS flash layer (including Java/NeqSim exceptions
73-
# that are not EcalcError subclasses) means the outlet state is not computable.
72+
except CompressorThermodynamicCalculationError as exc:
73+
# The compressor outlet thermodynamics could not produce a usable state
74+
# (invalid Campbell pressure guess, PH flash failure, or invalid PH result).
7475
raise OutletFluidNotAchievableError(
7576
process_unit_id=self._id,
7677
unachievable_operating_point=CompressorOperatingPoint(

0 commit comments

Comments
 (0)