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

Improve exception message when trying to read list property as scalar #29

Open
christian-rauch opened this issue May 11, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@christian-rauch
Copy link

I have a custom element with a list property:

element track 572
property list uint16 uint32 vertex_index

When trying to read it via:

const std::vector<uint32_t> track_ids = tracks.getElement("track").getProperty<uint32_t>("vertex_index");

I am getting the exception:

PLY parser: property vertex_index cannot be coerced to requested type uint. Has type unit

which is a bit confusing, since it detects the correct type (Has type unit) but fails to convert the type to the same type (cannot be coerced to requested type uint).

Is this a bug in the conversion, or is the uint32 type just not supported?

@christian-rauch
Copy link
Author

Ah, never mind. This is a list property and I tried to read it as a scalar property.

The correct call would be:

tracks.getElement("track").getListProperty<uint32_t>("vertex_index");

Maybe the exception should say something about list and scalar properties and not about the scalar type conversion.

@nmwsharp
Copy link
Owner

Thanks for filing! I'll convert this to a TODO to add a better error message.

@nmwsharp nmwsharp changed the title cannot read uint32 property list Improve exception message when trying to read list property as scalar May 12, 2021
@nmwsharp nmwsharp added the enhancement New feature or request label May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants