- return False, "Error invalid network_vlan_range less than 10 elements"
-
- except Exception,e:
- return (False, "Error loading configuration file '"+configuration_file+"': "+str(e))
- return (True, config)
+ raise LoadConfigurationException("Error at configuration file '{}'. Invalid network_vlan_range less than 10 elements".format)
+ return config
+ except yaml.YAMLError as exc:
+ error_pos = ""
+ if hasattr(exc, 'problem_mark'):
+ mark = exc.problem_mark
+ error_pos = " at position: ({}:{})".format(mark.line + 1, mark.column + 1)
+ raise LoadConfigurationException("Error loading configuration file '{}'{}: {}\n"
+ "Use a valid yaml format. Indentation matters, "
+ "and tabs characters are not valid".format(
+ configuration_file, error_pos, exc))
+ except js_e.ValidationError as exc:
+ error_pos = ""
+ if len(exc.path) > 0:
+ error_pos = " at '{}'".format(":".join(map(str, exc.path)))
+ raise LoadConfigurationException("Error loading configuration file '{}'{}: {}".format(
+ configuration_file, error_pos, exc))
+
+ # except Exception as e:
+ # raise LoadConfigurationException("Error loading configuration file '{}': {}".format(configuration_file, e))
+