Browse Source

Nice exceptions for settings validation fails

Yann Weber 8 years ago
parent
commit
85d11c0376
1 changed files with 9 additions and 1 deletions
  1. 9
    1
      lodel/settings/settings_loader.py

+ 9
- 1
lodel/settings/settings_loader.py View File

@@ -5,6 +5,7 @@ import glob
5 5
 import copy
6 6
 
7 7
 from lodel.settings.utils import *
8
+from lodel.settings.validator import SettingsValidationError
8 9
 
9 10
    
10 11
 ##@brief Merges and loads configuration files
@@ -60,7 +61,14 @@ class SettingsLoader(object):
60 61
             sec=conf[section]
61 62
             if keyname in sec:
62 63
                 optionstr=sec[keyname]['value']
63
-                option= validator(sec[keyname]['value'])
64
+                try:
65
+                    option= validator(sec[keyname]['value'])
66
+                except Exception as e:
67
+                    raise SettingsValidationError(
68
+                                                    "For %s.%s : %s" % 
69
+                                                    (section, keyname,e)
70
+                    )
71
+
64 72
                 try:
65 73
                     del self.__conf_sv[section + ':' + keyname]
66 74
                 except KeyError: #allready fetched

Loading…
Cancel
Save