From 851cfd76d82a71d60d837b6ead6c965104b0b1a4 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Thu, 27 Jun 2019 12:17:17 +0200 Subject: [PATCH] additional check in add command --- snippets/test8.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/snippets/test8.py b/snippets/test8.py index 8cdaa15..af4b027 100644 --- a/snippets/test8.py +++ b/snippets/test8.py @@ -311,8 +311,9 @@ class CmdInterpreter(cmd.Cmd): raise CmdInterpreterException('writeTopic must not be set when scanRate is zero') if feedbackTopic: raise CmdInterpreterException('feedbackTopic must not be set when scanRate is zero') - if registerType not in ['HoldingRegister']: - raise CmdInterpreterException('Unknown register type {0}'.format(registerType)) + allowedRegisterTypes = ['HoldingRegister'] + if registerType not in allowedRegisterTypes: + raise CmdInterpreterException('Unknown register type {0}, allowed are {1!s}'.format(registerType, allowedRegisterTypes)) except ValueError as e: