changeset 1131:9cf592d1e6aa

server: better error handling when a named page mentioned in menu_json is missing
author Goffi <goffi@goffi.org>
date Tue, 18 Sep 2018 21:16:51 +0200
parents 8a7d75c18d40
children 0cafb79ced6d
files libervia/server/server.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/server/server.py	Tue Sep 18 21:16:47 2018 +0200
+++ b/libervia/server/server.py	Tue Sep 18 21:16:51 2018 +0200
@@ -329,9 +329,10 @@
                 try:
                     url = self.getPageByName(page_name).url
                 except KeyError as e:
-                    log.error(_(u"Can'find a named page ({msg}), please check "
-                                u"menu_json in configuration.").format(msg=e))
-                    raise e
+                    log_msg = _(u"Can'find a named page ({msg}), please check "
+                                u"menu_json in configuration.").format(msg=e.args[0])
+                    log.error(log_msg)
+                    raise exceptions.ConfigError(log_msg)
             main_menu.append((page_name, url))
         self.main_menu = main_menu