Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NXDL parsing exceptions missing necessary details #1266

Closed
prjemian opened this issue May 30, 2023 · 1 comment · Fixed by #1289
Closed

NXDL parsing exceptions missing necessary details #1266

prjemian opened this issue May 30, 2023 · 1 comment · Fixed by #1289
Assignees
Milestone

Comments

@prjemian
Copy link
Contributor

Exceptions reported in CI do not indicate which NXDL file and line triggered each problem.

see: https://pipelines.actions.githubusercontent.com/serviceHosts/450b0598-1549-4d8a-b222-20c2cf327859/_apis/pipelines/1/runs/1080/signedlogcontent/2?urlExpires=2023-05-30T14%3A28%3A13.6751717Z&urlSigningMethod=HMACV1&urlSignature=QKq4zK3g8YPqFSGqqIhmHBWHqZUoV40VjIN%2B1daA7VU%3D

Originally posted by @prjemian in #1265 (comment)

@woutdenolf
Copy link
Contributor

woutdenolf commented Jun 20, 2023

https://github.com/nexusformat/definitions/actions/runs/5122807646/jobs/9212410397

File and line are displayed in the traceaback:

 lxml.etree.DocumentInvalid: Element '{http://definition.nexusformat.org/nxdl/3.1}dimensions': 
    This element is not expected. Expected is one of 
    ( {http://definition.nexusformat.org/nxdl/3.1}attribute, 
    {http://definition.nexusformat.org/nxdl/3.1}enumeration )., line 200

During handling of the above exception, another exception occurred:

definitions.dev_tools.globals.errors.NXDLSyntaxError: 
     /home/runner/work/definitions/definitions/contributed_definitions/NXfiber.nxdl.xml

This chained exception comes from

try:
       xml_schema.assertValid(xml_tree)
except lxml.etree.DocumentInvalid:
       raise errors.NXDLSyntaxError(xml_file_name)

We can improve the error message to include everything in a single error message instead looking down the chain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

3 participants