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

Check for ValueError exception when reading PDOMapping entrys from ED… #386

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Obsnold
Copy link

@Obsnold Obsnold commented Jul 7, 2023

Copy link
Collaborator

@acolomb acolomb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this possibly hides real errors? Like if someone writes PDOMapping=yes

Wouldn't it be better to check explicitly for an empty string and convert it to zero?

@Obsnold
Copy link
Author

Obsnold commented Jul 12, 2023

Sure that sounds good to me, I'll try and update ti today.

…y string, this way we don't mask any other errors
@Obsnold
Copy link
Author

Obsnold commented Jul 12, 2023

Alright I've updated it, please take another look.
Thanks!

@Obsnold
Copy link
Author

Obsnold commented Aug 2, 2023

@acolomb have you had time to look over the changes?


pdo_mappable_string = eds.get(section, "PDOMapping", fallback="0")
if pdo_mappable_string != "":
var.pdo_mappable = bool(int(pdo_mappable_string, 0))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it is still possible to have invalid input.

Maybe something like this?

var.pdo_mappable = eds.get(section, "PDOMapping", fallback="0") not in ("", "0")

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want the invalid input to throw an exception so real errors are caught, though I guess it's a question whether PDOMapping= is valid input or not?

I no longer have access to the EDS files that were causing the issue so I don't have anything to test against.
If I have time I'll try and poke around to see if I can find any other files that exhibit this issue.

it does make me wonder if the handling of invalid input on the other entries should also throw an error?

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

Successfully merging this pull request may close these issues.

3 participants