Correct Wrong "raise" in modbus validators. (#52924)

This commit is contained in:
jan iversen 2021-07-12 20:06:31 +02:00 committed by GitHub
parent 5c200581b6
commit 5caf170c78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -78,10 +78,8 @@ def sensor_schema_validator(config):
if config[CONF_DATA_TYPE] != DATA_TYPE_CUSTOM:
try:
structure = f">{DEFAULT_STRUCT_FORMAT[data_type]}"
except KeyError:
raise vol.Invalid(
f"Modbus error {data_type} unknown in {name}"
) from KeyError
except KeyError as exp:
raise vol.Invalid(f"Modbus error {data_type} unknown in {name}") from exp
else:
if not structure:
raise vol.Invalid(