From 1548cb35b939926640f93c366cde724841506e2a Mon Sep 17 00:00:00 2001 From: imcovangent <I.vanGent@tudelft.nl> Date: Tue, 27 Mar 2018 11:14:35 +0200 Subject: [PATCH] Small adjustments to load function concerning error messages. Former-commit-id: 245a1051fbaa6bfd367423cd68a672afb40e44d4 --- kadmos/graph/graph_kadmos.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kadmos/graph/graph_kadmos.py b/kadmos/graph/graph_kadmos.py index 8c56f62a4..8562cf4c7 100644 --- a/kadmos/graph/graph_kadmos.py +++ b/kadmos/graph/graph_kadmos.py @@ -4609,7 +4609,8 @@ def _check_roots(io_list): logger.debug('Inconsistent root of element found in XML file {}'.format(file_name)) logger.debug('Inconsistent root: {}'.format(current_root.tag)) logger.debug('Inconsistent w.r.t. standard root: {}'.format(previous_root.tag)) - raise IOError('Inconsistent root') + raise IOError('Inconsistent root in file {} (root found: {}, expected root: {})' + .format(file_name, current_root.tag, previous_root.tag)) previous_root = current_root first_file = False return @@ -4648,6 +4649,7 @@ def _get_leafs(io_list): leafs = list(leafs) return leafs + def _check_leafs(io_list, leafs): """ This function checks if there are elements in other files with the same element that still have child elements. @@ -4671,6 +4673,7 @@ def _check_leafs(io_list, leafs): leafs.remove(leaf) return + def parse_check(io_list): logger.info('Checking for parsing errors...') for entry in io_list: @@ -4687,5 +4690,5 @@ def _try_parsing(file_path): logger.debug('Could not parse XML file {}. Check file structure.'.format(os.path.split(file_path)[1])) logger.debug('To avoid parser errors, use an XML editor to build and adjust files.') logger.warning('ERROR: {}'.format(e)) - raise + raise IOError('Could not parse XML file {}. Check file structure.'.format(os.path.split(file_path)[1])) return tree -- GitLab