Skip to content

Commit

Permalink
Refactor error message
Browse files Browse the repository at this point in the history
Signed-off-by: EstherLerouzic <[email protected]>
Change-Id: Ie8fc6bedcdbce26e2e80759c6c56d2c7429bf560
  • Loading branch information
EstherLerouzic committed Oct 24, 2023
1 parent a3b1157 commit 33cc11b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions gnpy/core/equipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ def trx_mode_params(equipment, trx_type_variety='', trx_mode='', error_message=F
trx_params = {**mode_params}
# sanity check: spacing baudrate must be smaller than min spacing
if trx_params['baud_rate'] > trx_params['min_spacing']:
raise EquipmentConfigError(f'Inconsistency in equipment library:\n Transpoder "{trx_type_variety}" mode "{trx_params["format"]}" ' +
f'has baud rate {trx_params["baud_rate"]*1e-9} GHz greater than min_spacing {trx_params["min_spacing"]*1e-9}.')
raise EquipmentConfigError(f'Inconsistency in equipment library:\n Transponder "{trx_type_variety}"'
+ f' mode "{trx_params["format"]}" has baud rate'
+ f' {trx_params["baud_rate"] * 1e-9:.3f} GHz greater than min_spacing'
+ f' {trx_params["min_spacing"] * 1e-9:.3f}.')
else:
mode_params = {"format": "undetermined",
"baud_rate": None,
Expand Down

0 comments on commit 33cc11b

Please sign in to comment.