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

Better error handling #18

Open
Emilgardis opened this issue Jan 8, 2017 · 5 comments
Open

Better error handling #18

Emilgardis opened this issue Jan 8, 2017 · 5 comments

Comments

@Emilgardis
Copy link
Member

Emilgardis commented Jan 8, 2017

See related issue rust-embedded/svd2rust#51
svd-parser uses Option<String> for ElementExt::get_child_text, and an expect is done with the defined try! macro in lib.rs, avoiding any way of knowing what had gone wrong. I propose for svd-parser to use error-chain to fix this problem, but also to use a logging crate to make debugging svd errors easier for the user without having to use utilities like SVDConv.exe to check for errors in the svd file and to see if the error is by missing implementation in svd2rust.

@Emilgardis
Copy link
Member Author

I have a WIP branch that does this. It is not exactly what I would like it to be currently, but it gives me a much better picture of what happened on an error.

@Emilgardis
Copy link
Member Author

I'm going to wait for rust-embedded/svd2rust#53 and then rebase my branch. I have also implemented #21 on that branch, it should be on a separate pr.

@robamu
Copy link

robamu commented Oct 28, 2021

Hello,

Whats the state of this issue? I am trying to generate a PAC for the VA108xx device by using their svd files and I think something like a line number for this error

[ERROR svd2rust] expected `,`

would help

@Emilgardis
Copy link
Member Author

This has been done, but it could be improved upon, I dont think we can capture line numbers currently, but I will check. I'll return to you in your other comment on issue #41

@robamu
Copy link

robamu commented Oct 29, 2021

I have dug a little bit deeper and I can confirm that the error comes from the syn crate when calling generate::device::render. The precise error happens at convert_svd_register / name_to_wrapped_ty . I would say this needs to be fixed in svd2rust then but I don't know the data structure generated by the parser well enough to say whether any of the data returned in "invalid"

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