From 9c99423a780cd2460cdafaf47b134108897fba5e Mon Sep 17 00:00:00 2001 From: blob8108 Date: Wed, 28 May 2014 21:34:32 +0100 Subject: Raise an exception for non-existent menu names --- blockext/blocks.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/blockext/blocks.py b/blockext/blocks.py index 148866b..a58bafc 100644 --- a/blockext/blocks.py +++ b/blockext/blocks.py @@ -116,9 +116,13 @@ class Input(object): if self.default is None: self.default = "" if self.shape == "readonly-menu": - options = menus[self.menu] - if options: - self.default = options[0] + try: + options = menus[self.menu] + except KeyError: + raise ValueError( + "menu not found: {}".format(repr(self.menu)) + ) + self.default = options[0] INPUT_SPECS = { -- cgit v1.3.1