Improve exception message when trying to read list property as scalar

Open
#29 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp
Domain
tooling

Research direction

Start by tracing the getProperty<uint32_t>("vertex_index") call for list properties and follow the exception path that produces the coercion message. Check how list element types are reported and converted, then confirm the behavior with a focused parser test covering a uint16/uint32 list property and scalar access.

Written by the indexing model from the issue text.

Description

enhancement

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?

Dominant language
C++
Stars
406
Forks
74
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nmwsharp/happly

All issues in nmwsharp/happly

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.