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

Make XML errors easier to debug during codegen #1204

Open
andy31415 opened this issue Nov 8, 2023 · 3 comments
Open

Make XML errors easier to debug during codegen #1204

andy31415 opened this issue Nov 8, 2023 · 3 comments

Comments

@andy31415
Copy link
Contributor

We had a type error recently in two separate reasons: uint16 used instead of int16u and once a type being "" (not sure why ... maybe an erase that was never updated).

The code generator failed with very hard to debug errors like:

TypeError: Cannot read properties of undefined (reading 'startsWith')
    at Object.atomicType (/snapshot/zap/dist/src-electron/generator/overridable.js:63:14)
    at Object.atomicType (/snapshot/zap/dist/src-electron/generator/template-engine.js:175:31)
    at /snapshot/zap/dist/src-electron/util/zcl-util.js:545:47
    at async Promise.all (index 0)

Instead we should have some context on various things, in this case for example atomicType should at least tell me what type it was trying to process, so I could have seen uint16 being at fault.

Ideally though, we should also have XML context inside types. I would have liked the trace to tell me "in foo.xml, type defined at line 123 failed to be processed" and then human review would have been much easier. As it stands we had to bisect all types one by one in XML which is very slow.

@paulr34
Copy link
Collaborator

paulr34 commented Nov 9, 2023

@andy31415 we have XML type warnings like this
Screenshot 2023-11-09 at 12 49 01 PM

@paulr34
Copy link
Collaborator

paulr34 commented Nov 9, 2023

also if you click extensions you can see
Screenshot 2023-11-09 at 12 50 56 PM

@andy31415
Copy link
Contributor Author

Checked offline, the existing warnings did not catch the errors in the XML I had (neither empty type nor using uint16 instead of int16u)

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

No branches or pull requests

2 participants