Skip to content

Misleading error thrown by getElementProps #8509

Description

@Josh-Schifter

Describe the bug
iModel.Elements.getElementProps throws 'Element not found' regardless of the cause of the error.

To Reproduce

const regionId = "0x000001" // a valid id for a region element in the iModel
const badId = {id: regionId} as unknown as Id64String;
const element = iModel.elements.getElementProps<SectionDrawingLocationProps>({ id: badId, wantGeometry: true });

other variations throw the same error:

//const spatialRegion = iModel.elements.getElementProps<SectionDrawingLocationProps>({ id: badId , wantGeometry: true });
//const spatialRegion = iModel.elements.getElementProps<SectionDrawingLocationProps>(badId );
//const spatialRegion = iModel.elements.tryGetElementProps(badId );
//const spatialRegion = iModel.elements.tryGetElement(badId );

Expected behavior
Throw a more meaningful error.

Metadata

Metadata

Labels

ecdbECDb and ECSQL related issues

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions